| Copyright | 2013 Kei Hibino |
|---|---|
| License | BSD3 |
| Maintainer | ex8k.hibino@gmail.com |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | None |
| Language | Haskell2010 |
Database.HDBC.Session
Contents
Description
This module provides a base bracketed function to call close correctly against opend DB connection.
- 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
- withConnectionIO :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
- withConnectionIO' :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
- showSqlError :: SqlError -> String
- handleSqlError' :: IO a -> IO a
Bracketed session
Bracket function implementation is provided by several packages, so this package provides base implementation which requires bracket function and corresponding lift function.
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.
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.
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
handleSqlError' :: IO a -> IO a Source
Like handleSqlError, but not to show String fields of SqlError.