HDBC-session-0.1.2.1: Bracketed connection for HDBC
Copyright2013-2018 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Database.HDBC.Session

Description

This module provides a base bracketed function to call close correctly against opend DB connection.

Synopsis

Bracketed session

Bracket function implementation is provided by several packages, so this package provides base implementation which requires bracket function and corresponding lift function.

transaction Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Run a transaction on a HDBC IConnection and commit at last, and then close the connection. In other words, the transaction with no exception is committed. Handy definition for simple transactions.

withConnectionIO Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Run a transaction on a HDBC IConnection and close the connection. Not issuing commit at last, so if you need, issue commit manually in transaction body.

withConnectionIO_ Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Same as withConnectionIO other than not wrapping transaction body in handleSqlError'.

bracketConnection Source #

Arguments

:: (Monad m, IConnection conn) 
=> (forall c. m c -> (c -> m ()) -> (c -> m a) -> m a)

bracket

-> (forall b. IO b -> m b)

lift

-> IO conn

Connect action

-> (conn -> m a)

Transaction body

-> m a 

Generalized session with bracketed HDBC connection. Run a transaction on a HDBC IConnection and close the connection.

Show errors

Functions to show SqlError type not to show String fields.

showSqlError :: SqlError -> String Source #

show SqlError not to show String fields.

handleSqlError' :: IO a -> IO a Source #

Like handleSqlError, but not to show String fields of SqlError.

Deprecated

withConnection :: (Monad m, IConnection conn) => (forall c. m c -> (c -> m ()) -> (c -> m a) -> m a) -> (forall b. IO b -> m b) -> IO conn -> (conn -> m a) -> m a Source #

Deprecated: use bracketConnection instead of this.

Deprecated. use bracketConnection instead of this.

withConnectionIO' Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Deprecated: use withConnectionIO instead of this.

Deprecated. use withConnectionIO instead of this.

withConnectionCommit Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Deprecated: use transaction instead of this.

Deprecated. use transaction instead of this.