vendredi 5 février 2016

How to execute INSERT prepared statement using sqlite-simple?

sqlite-simple is able to create prepared statements, but I cannot figure out how to use them with instructions that do not return results. That is:

main = do
  db <- open "test.db"
  let a = 1
  let b = 2
  withStatement db "INSERT INTO test VALUES (?, ?)" $ \stmt -> do
    bind stmt (a, b)
    ???
    reset stmt

The one API that "fits" in ??? is nextRow which requires data to be returned. So, how are prepared statements that return no results supposed to be used?

Aucun commentaire:

Enregistrer un commentaire