HDBC-session-0.1.1.0: Bracketed connection for HDBC

Copyright2013-2016 Kei Hibino
LicenseBSD3
Maintainerex8k.hibino@gmail.com
Stabilityexperimental
Portabilityunknown
Safe HaskellNone
LanguageHaskell2010

Database.HDBC.Session

Contents

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.

withConnectionCommit Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

Same as withConnectionIO other than issuing commit at the end of transaction body. In other words, the transaction with no exception is committed. Handy defintion 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. Simple IO version.

withConnectionIO' Source #

Arguments

:: IConnection conn 
=> IO conn

Connect action

-> (conn -> IO a)

Transaction body

-> IO a

Result transaction action

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

withConnection 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 

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.