Connect to a PostgreSQL database using a connection string.
$$\text{connect} : \text{String} \to \text{IO}\ \text{PgConn}$$
The connection string follows libpq format:
"host=localhost port=5432 dbname=mydb user=myuser" or a URI
"postgresql://user:pass@host/db".
Return the status of the connection. $$\text{status} : \text{PgConn} \to \text{IO}\ \text{ConnStatus}$$
Equations
- Database.PostgreSQL.LibPQ.status conn = do let raw ← Database.PostgreSQL.LibPQ.statusRaw✝ conn pure (Database.PostgreSQL.LibPQ.ConnStatus.ofUInt8 raw)
Instances For
Return the error message most recently generated by a connection operation.
Close the connection immediately (before GC would finalize it).
Execute a parameterized query. Parameters are passed as an array of optional strings (None = SQL NULL). $$\text{execParams} : \text{PgConn} \to \text{String} \to \text{Array}\ (\text{Option String}) \to \text{IO}\ \text{PgResult}$$
Return the result status of a query.
Equations
- Database.PostgreSQL.LibPQ.resultStatus result = do let raw ← Database.PostgreSQL.LibPQ.resultStatusRaw✝ result pure (Database.PostgreSQL.LibPQ.ExecStatus.ofUInt8 raw)
Instances For
Return the error message associated with a result, or empty string.
Return the number of rows in the result set.
Return the number of columns in the result set.
Return the number of rows affected by the command (as a string).
Consume any available input from the server (non-blocking).
Returns true if no error occurred.
Return the next notification from the server, if any.
Return the current in-transaction status of the server.
Equations
Instances For
Execute a query and check the result status. Throws IO.userError
if the result indicates an error.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Connect and verify the connection is OK. Throws IO.userError
if the connection failed.
Equations
- One or more equations did not get rendered due to their size.