Parameterized SQL statement: Difference between revisions

Content added Content deleted
Line 312: Line 312:
Example uses the [http://hackage.haskell.org/package/HDBC <tt>HDBC</tt>] package:
Example uses the [http://hackage.haskell.org/package/HDBC <tt>HDBC</tt>] package:


<lang haskell>
<lang haskell>module Main (main) where
module Main (main) where


import Database.HDBC (IConnection, commit, run, toSql)
import Database.HDBC (IConnection, commit, run, toSql)
Line 332: Line 331:


main :: IO ()
main :: IO ()
main = undefined
main = undefined</lang>
</lang>


You'll need an instance of a type with an instance for the <tt>IConnection</tt> type class in order to use this function, such as [http://hackage.haskell.org/package/HDBC-postgresql-2.3.2.5/docs/Database-HDBC-PostgreSQL.html#t:Connection <tt>Connection</tt>] from [http://hackage.haskell.org/package/HDBC-postgresql <tt>HDBC-postgresql</tt>].
You'll need an instance of a type with an instance for the <tt>IConnection</tt> type class in order to use this function, such as [http://hackage.haskell.org/package/HDBC-postgresql-2.3.2.5/docs/Database-HDBC-PostgreSQL.html#t:Connection <tt>Connection</tt>] from [http://hackage.haskell.org/package/HDBC-postgresql <tt>HDBC-postgresql</tt>].