Safe Haskell | None |
---|---|
Language | Haskell2010 |
An ODBC backend for persistent.
Synopsis
- withODBCPool :: (MonadUnliftIO m, MonadLogger m) => Maybe DBType -> ConnectionString -> Int -> (ConnectionPool -> m a) -> m a
- withODBCConn :: (MonadUnliftIO m, MonadLogger m) => Maybe DBType -> ConnectionString -> (SqlBackend -> m a) -> m a
- createODBCPool :: (MonadUnliftIO m, MonadLogger m) => Maybe DBType -> ConnectionString -> Int -> m ConnectionPool
- type ConnectionString = String
- data OdbcConf = OdbcConf {}
- openSimpleConn :: LogFunc -> Maybe DBType -> Connection -> IO SqlBackend
- data DBType
- mysql :: DBType
- postgres :: DBType
- mssqlMin2012 :: DBType
- mssql :: DBType
- oracleMin12c :: DBType
- oracle :: DBType
- db2 :: DBType
- sqlite :: DBType
Documentation
:: (MonadUnliftIO m, MonadLogger m) | |
=> Maybe DBType | |
-> ConnectionString | Connection string to the database. |
-> Int | Number of connections to be kept open in the pool. |
-> (ConnectionPool -> m a) | Action to be executed that uses the connection pool. |
-> m a |
Create an ODBC connection pool and run the given
action. The pool is properly released after the action
finishes using it. Note that you should not use the given
ConnectionPool
outside the action since it may be already
been released.
withODBCConn :: (MonadUnliftIO m, MonadLogger m) => Maybe DBType -> ConnectionString -> (SqlBackend -> m a) -> m a Source #
Same as withODBCPool
, but instead of opening a pool
of connections, only one connection is opened.
:: (MonadUnliftIO m, MonadLogger m) | |
=> Maybe DBType | |
-> ConnectionString | Connection string to the database. |
-> Int | Number of connections to be kept open in the pool. |
-> m ConnectionPool |
Create an ODBC connection pool. Note that it's your
responsibility to properly close the connection pool when
unneeded. Use withODBCPool
for an automatic resource
control.
type ConnectionString = String Source #
An HDBC-odbc
connection string. A simple example of connection
string would be DSN=hdbctest1
.
Information required to connect to an ODBC database
using persistent
's generic facilities. These values are the
same that are given to withODBCPool
.
OdbcConf | |
|
Instances
PersistConfig OdbcConf Source # | |
type PersistConfigBackend OdbcConf Source # | |
Defined in Database.Persist.ODBC type PersistConfigBackend OdbcConf = SqlPersistT | |
type PersistConfigPool OdbcConf Source # | |
Defined in Database.Persist.ODBC type PersistConfigPool OdbcConf = ConnectionPool |
openSimpleConn :: LogFunc -> Maybe DBType -> Connection -> IO SqlBackend Source #
Generate a persistent Connection
from an odbc Connection