úÎCAi     None CTemplatePG currenly only supports a handful of types. It also doesn't M distinguish between numeric types with different ranges. More types are the 4 most likely feature of future TemplatePG releases. &interval (a time interval), send-only date (day without time) 'timestamptz (timestamp with time zone) text/varchar float integer bool "Convert a type OID from PostgreSQL's catalog to a TemplatePG ) representation. To get a list of types:  SELECT typname, oid FROM pg_type J Note that I have assumed, but not tested, that type OIDs for these basic 5 types are consistent across installations. If not, I'm going to have to ' switch to using the text descriptions KConvert a Haskell value to a string of the given PostgreSQL type. Or, more G accurately, given a PostgreSQL type, create a function for converting 7 compatible Haskell values into a string of that type.  )pgTypeToString :: PGType -> (? -> String) GConvert a string from PostgreSQL of the given type into an appropriate G Haskell value. Or, more accurately, given a PostgreSQL type, create a I function for converting a string of that type into a compatible Haskell  value.  )pgStringToType :: PGType -> (String -> ?) PostgreSQL type OID    None +PGException is thrown upon encountering an  with severity of J ERROR, FATAL, or PANIC. It holds the SQLSTATE and message of the error.  Connect to a PostgreSQL server. CDisconnect from a PostgreSQL server. Note that this currently doesn't send  a close message. Describe a SQL statement/0query. A statement description consists of 0 or I more parameter descriptions (a PostgreSQL type) and zero or more result I field descriptions (for queries) (consist of the name of the field, the 2 type of the field, and a nullability indicator). ;A simple query is one which requires sending only a single  M message to the PostgreSQL server. The query is sent as a single string; you J cannot bind parameters. Note that queries can return 0 results (an empty  list). JWhile not strictly necessary, this can make code a little bit clearer. It  executes a  but doesn't look for results. KAll PostgreSQL messages have a common header: an identifying character and  a 32-bit size field. the host to connect to the port to connect on the database to connect to the username to connect as the password to connect with 6a handle to communicate with the PostgreSQL server on a handle from    SQL string `a list of parameter types, and a list of result field names, types, and nullability indicators.  SQL string A list of result rows,  which themselves are a list  of fields.  SQL string     None ?queryTuples :: String -> (Handle -> IO [(column1, column2, ...)])FQuery a PostgreSQL server and return the results as a list of tuples. Example (where h is a handle from  ):  $(queryTuples "%SELECT usesysid, usename FROM pg_user") h $=> IO [(Maybe String, Maybe Integer)] FqueryTuple :: String -> (Handle -> IO (Maybe (column1, column2, ...)))GConvenience function to query a PostgreSQL server and return the first = result as a tuple. If the query produces no results, return . Example (where h is a handle from  ):  let sysid = 10::Integer;  $(queryTuple ">SELECT usesysid, usename FROM pg_user WHERE usesysid = {sysid}") h +=> IO (Maybe (Maybe String, Maybe Integer)) &execute :: String -> (Handle -> IO ())FConvenience function to execute a statement on the PostgreSQL server. Example (where h is a handle from  ):  let rolename = "BOfH"  $(execute "CREATE ROLE {rolename}") h => IO ()FRun a sequence of IO actions (presumably SQL statements) wrapped in a  transaction. Unfortunately you'#re restricted to using this in the  ! Monad for now due to the use of . I'm debating adding a   MonadPeelIO version. Untested. #Roll back a transaction. Untested. ERun an INSERT statement, ignoring duplicate key errors. This is also  limited to the  Monad. Untested. None        !"#$% &'(templatepg-0.2.2Database.TemplatePG.TypesDatabase.TemplatePG.ProtocolDatabase.TemplatePG.SQLDatabase.TemplatePGPGType PGIntervalPGDate PGTimestampTZPGTextPGReal PGInteger PGBoolean pgTypeFromOIDpgTypeToStringpgStringToType PGException pgConnect pgDisconnectdescribeStatementexecuteSimpleQueryexecuteSimpleStatement queryTuples queryTupleexecutewithTransactionrollback insertIgnore ErrorResponse SimpleQuery$fBinaryPGMessage$fExceptionPGExceptionbase Data.MaybeNothingghc-prim GHC.TypesIOControl.Exception.Base onException