persistent-odbc-0.2.0.1: Backend for the persistent library using ODBC

Safe HaskellNone
LanguageHaskell98

Database.Persist.ODBC

Description

An ODBC backend for persistent.

Synopsis

Documentation

withODBCPool Source

Arguments

:: (MonadBaseControl IO m, MonadLogger m, MonadIO 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 :: (MonadLogger m, MonadIO m, MonadBaseControl IO 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.

createODBCPool Source

Arguments

:: (MonadLogger m, MonadIO m, MonadBaseControl IO 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.

data OdbcConf Source

Information required to connect to a PostgreSQL database using persistent's generic facilities. These values are the same that are given to withODBCPool.

Constructors

OdbcConf 

Fields

odbcConnStr :: ConnectionString

The connection string.

odbcPoolSize :: Int

How many connections should be held on the connection pool.

odbcDbtype :: String
 

Instances

PersistConfig OdbcConf 
type PersistConfigPool OdbcConf = ConnectionPool 
type PersistConfigBackend OdbcConf = SqlPersistT 

openSimpleConn :: LogFunc -> Maybe DBType -> Connection -> IO SqlBackend Source

Generate a persistent Connection from an odbc Connection

data DBType Source

List of DBMS that are supported

Constructors

MySQL 
Postgres 
MSSQL 

Fields

mssql2012 :: Bool
 
Oracle 

Fields

oracle12c :: Bool
 
DB2 
Sqlite 

Fields

sqlite3619 :: Bool
 

Instances