HDBC-session-0.0.1.1: Bracketed connection for HDBC

Copyright2013 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.

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.

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'.

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.