I just answered my own question... I had forgotten the type signature on the storeSummary function. When I added the type signature below, it coerced the Maybe RoR (which is a Double) into a REAL in sqlite3.
Hello, I'm stumped on using Takusen to insert values of type Maybe into a sqlite database when the underlying database has a field type of REAL.When I bind a Maybe to an underlying sqlite field of type DATETIME or INTEGER, the value is stored correctly. However, when I bind a Maybe value to a database field of type REAL, the value is inserted as "Just ..." or "Nothing".I thought bindP would coerce the Maybe type either into the value or a database null. What am I missing?Here is an example of an inserted record in the database:
sqlite> select * from summary;20110331|100002|Just 0.37427717861180376|Just 2.198753718609092|Just 9.402720712996771|Just 17.50143032492688|Just 8.250653601136904|Nothing|Nothing|Just 6.190434991035554Here is the function:storeSummary date account returns = dodbh <- openDbwithSession dbh (doexecDML(cmdbind "REPLACE INTO summary (date,account_id,one_mo,three_mo,one_yr,two_yr,three_yr,four_yr,five_yr,incept) \\VALUES (?,?,?,?,?,?,?,?,?,?)" [bindP (Just date), bindP (Just account),bindP (returns !! 0),bindP (returns !! 1),bindP (returns !! 2),bindP (returns !! 3),bindP (returns !! 4),bindP (returns !! 5),bindP (returns !! 6),bindP (returns !! 7) ]))And the database:sqlite>.schema summaryCREATE TABLE "SUMMARY" ("DATE" DATETIME NOT NULL ,"ACCOUNT_ID" INTEGER NOT NULL ,"ONE_MO" REAL,"THREE_MO" REAL,"ONE_YR" REAL,"TWO_YR" REAL,"THREE_YR" REAL,"FOUR_YR" REAL,"FIVE_YR" REAL,"INCEPT" REAL, PRIMARY KEY ("DATE","ACCOUNT_ID") )Thanks in advance,Neil