I'm trying to figure out how to use the sqlite moduls for haskell. This is my basic code:
import Database.SQLite
firstTry str = do
conn <- openConnection $ "/Users/frkkan96/Documents/src/umecore-hs/testdata/ume.umedb"
statement <- return $ "select * from segments where label = :n ;"
b <- execParamStatement conn statement [(":n", Text "First words")]
closeConnection conn
Now, this does not compile (ghci):
sqlitetest.hs:6:9:
No instance for (SQLiteResult a0)
arising from a use of `execParamStatement'
In a stmt of a 'do' block:
execParamStatement conn statement [(":n", Text "First words")]
In the expression:
do { conn <- openConnection
$ "/Users/frkkan96/Documents/src/umecore-hs/testdata/ume.umedb";
statement <- return $ "select * from segments where label = :n ;";
execParamStatement conn statement [(":n", Text "First words")];
closeConnection conn }
In an equation for `firstTry':
firstTry str
= do { conn <- openConnection
$ "/Users/frkkan96/Documents/src/umecore-hs/testdata/ume.umedb";
statement <- return $ "select * from segments where label = :n ;";
execParamStatement conn statement [(":n", Text "First words")];
.... }
Not sure what to do with that though. execParamStatement_ works, but of course does not return anything, which makes it less useful for understanding how to get data out of the database.
Aucun commentaire:
Enregistrer un commentaire