| Copyright | 2013-2018 Kei Hibino |
|---|---|
| License | BSD3 |
| Maintainer | ex8k.hibino@gmail.com |
| Stability | experimental |
| Portability | unknown |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Database.HDBC.Session
Description
This module provides a base bracketed function to call close correctly against opend DB connection.
Synopsis
- transaction :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
- withConnectionIO :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
- withConnectionIO_ :: IConnection conn => IO conn -> (conn -> IO a) -> IO a
- bracketConnection :: (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
- showSqlError :: SqlError -> String
- handleSqlError' :: IO a -> IO a
- 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
- withConnectionCommit :: IConnection conn => IO conn -> (conn -> 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
| :: 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.
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.
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'.
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
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.
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.
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.