0

I have written the following trigger. When I execute it, ghc. exe crashes.

It says "ghc.exe has stopped working. windows is currently looking for a solution to this problem. This is something I've never experienced".

calculateNoOfStocksTraded ::String->Database.HDBC.Sqlite3.Connection->IO ()
calculateNoOfStocksTraded code conn=do                             
  res <- quickQuery' conn  "SELECT SUM(volume) FROM historicalData WHERE companyCode = ? " [toSql code]
  let conv=convertSqlValToInt res

  run conn "CREATE TRIGGER calStocks \
           \AFTER INSERT ON historicalData \
           \FOR EACH ROW \
           \BEGIN \
           \UPDATE company \
           \SET noOfStocks= ? ; \
           \END; " [toSql (conv::Integer)]

  commit conn
daniel gratzer
  • 52,833
  • 11
  • 94
  • 134
Prasadika
  • 897
  • 2
  • 20
  • 36
  • 1. Formatting your code is always a good idea when posting to stackoverflow 2. What library name/version – daniel gratzer Dec 30 '13 at 13:01
  • This is about HDBC (Haskell Database Connectivity ) and Sqlite3. I'm sorry your if my answer is not clear. Because I'm really very new to Haskell and Sqlite. – Prasadika Dec 30 '13 at 13:03
  • If I do something like the following run conn "CREATE TRIGGER calStocks \ \AFTER INSERT ON historicalData \ \FOR EACH ROW \ \BEGIN \ \UPDATE company \ \SET noOfStocks= 3456789123456? ; \ \END; " [] Then it works. But that's not what I want. I have to compare it with the value in the variable conv – Prasadika Dec 30 '13 at 13:04

0 Answers0