Safe Haskell | None |
---|
Database.TemplatePG.Protocol
Description
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 :: String -> Handle -> IO [[Maybe ByteString]]
- executeSimpleStatement :: String -> Handle -> 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.
Constructors
PGException String String |
Instances
Arguments
:: 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.
Arguments
:: 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).
Arguments
:: String | SQL string |
-> Handle | |
-> 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).
While not strictly necessary, this can make code a little bit clearer. It
executes a SimpleQuery
but doesn't look for results.