The Protocol module allows for direct, low-level communication with a PostgreSQL server over TCP/IP. You probably don't want to use this module directly.
- data PGException = PGException String String
- pgConnect :: HostName -> PortID -> String -> String -> String -> IO Handle
- pgDisconnect :: Handle -> IO ()
- describeStatement :: Handle -> String -> IO ([PGType], [(String, PGType, Bool)])
- executeSimpleQuery :: Handle -> String -> IO [[Maybe ByteString]]
- executeSimpleStatement :: Handle -> String -> IO ()
Documentation
data PGException Source
PGException is thrown upon encountering an ErrorResponse
with severity of
ERROR, FATAL, or PANIC. It holds the SQLSTATE and message of the error.
:: HostName | the host to connect to |
-> PortID | the port to connect on |
-> String | the database to connect to |
-> String | the username to connect as |
-> String | the password to connect with |
-> IO Handle | a handle to communicate with the PostgreSQL server on |
Connect to a PostgreSQL server.
Disconnect from a PostgreSQL server. Note that this currently doesn't send a close message.
:: Handle | |
-> String | SQL string |
-> IO ([PGType], [(String, PGType, Bool)]) | a list of parameter types, and a list of result field names, types, and nullability indicators. |
Describe a SQL statement/query. A statement description consists of 0 or more parameter descriptions (a PostgreSQL type) and zero or more result field descriptions (for queries) (consist of the name of the field, the type of the field, and a nullability indicator).
:: Handle | |
-> String | SQL string |
-> IO [[Maybe ByteString]] | A list of result rows, which themselves are a list of fields. |
A simple query is one which requires sending only a single SimpleQuery
message to the PostgreSQL server. The query is sent as a single string; you
cannot bind parameters. Note that queries can return 0 results (an empty
list).