2 | import Postgres.FFI.Utility
3 | import Postgres.Data.Conn
4 | import Postgres.Result
6 | %foreign libpq "PQexec"
8 | prim__dbExec : Ptr PGconn -> (command: String) -> PrimIO (Ptr PGresult)
10 | data ExecSource : Type where
11 | MkExecSource : Conn -> ExecSource
13 | ResultProducer ExecSource String where
14 | exec (MkExecSource conn) = pgExec conn where
15 | pgExec : Conn -> (command: String) -> IO (Ptr PGresult)
16 | pgExec (MkConn conn) command = primIO $
prim__dbExec conn command
21 | withExecResult : Conn -> (command : String) -> (f : Result -> IO b) -> IO b
22 | withExecResult conn command = withResult (MkExecSource conn) command
25 | ignore : Result -> IO ()