| Copyright | 2016 Dylan Simon |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Database.PostgreSQL.Typed.HDBC
Description
Use postgresql-typed as a backend for HDBC.
Synopsis
- data Connection
- connect :: PGDatabase -> IO Connection
- fromPGConnection :: PGConnection -> IO Connection
- withPGConnection :: Connection -> (PGConnection -> IO a) -> IO a
- reloadTypes :: Connection -> IO Connection
- connectionFetchSize :: Connection -> Word32
- setFetchSize :: Word32 -> Connection -> Connection
Documentation
data Connection Source #
A wrapped PGConnection.
This differs from a bare PGConnection in a few ways:
- It always has exactly one active transaction (with
pgBegin) - It automatically disconnects on GC
- It provides a mutex around the underlying
PGConnectionfor thread-safety
Instances
| IConnection Connection Source # | |
Defined in Database.PostgreSQL.Typed.HDBC Methods disconnect :: Connection -> IO () # commit :: Connection -> IO () # rollback :: Connection -> IO () # runRaw :: Connection -> String -> IO () # run :: Connection -> String -> [SqlValue] -> IO Integer # prepare :: Connection -> String -> IO Statement # clone :: Connection -> IO Connection # hdbcDriverName :: Connection -> String # hdbcClientVer :: Connection -> String # proxiedClientName :: Connection -> String # proxiedClientVer :: Connection -> String # dbServerVer :: Connection -> String # dbTransactionSupport :: Connection -> Bool # getTables :: Connection -> IO [String] # describeTable :: Connection -> String -> IO [(String, SqlColDesc)] # | |
connect :: PGDatabase -> IO Connection Source #
fromPGConnection :: PGConnection -> IO Connection Source #
Convert an existing PGConnection to an HDBC-compatible Connection.
The caveats under connectionPG apply if you plan to continue using the original PGConnection.
withPGConnection :: Connection -> (PGConnection -> IO a) -> IO a Source #
Use the underlying PGConnection directly. You must be careful to ensure that the first invariant is preserved: you should not call pgBegin, pgCommit, or pgRollback on it. All other operations should be safe.
reloadTypes :: Connection -> IO Connection Source #
Reload the table of all types from the database. This may be needed if you make structural changes to the database.
setFetchSize :: Word32 -> Connection -> Connection Source #
Change the connectionFetchSize for new Statements created with prepare.
Ideally this could be set with each call to execute and fetchRow, but the HDBC interface provides no way to do this.