| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Hpgsql.Transaction
Synopsis
- withTransaction :: HPgConnection -> IO a -> IO a
- withTransactionMode :: HPgConnection -> IsolationLevel -> ReadWriteMode -> IO a -> IO a
- begin :: HPgConnection -> IO ()
- beginMode :: HPgConnection -> IsolationLevel -> ReadWriteMode -> IO ()
- commit :: HPgConnection -> IO ()
- rollback :: HPgConnection -> IO ()
- transactionStatus :: HPgConnection -> IO TransactionStatus
- data IsolationLevel
- data ReadWriteMode
- data TransactionStatus
Documentation
withTransaction :: HPgConnection -> IO a -> IO a Source #
Runs the supplied function inside a transaction with the database's
default isolation level and read-write mode, i.e. BEGINs a transaction,
runs the supplied function and then COMMITs if there are no exceptions.
In case the supplied function throws an exception, this runs ROLLBACK.
In case an asynchronous exception is thrown, Hpgsql ensures a ROLLBACK
will be issued before your next query on the same connection.
withTransactionMode :: HPgConnection -> IsolationLevel -> ReadWriteMode -> IO a -> IO a Source #
Runs the supplied function inside a transaction with the supplied
isolation level and read-write mode, i.e. BEGINs a transaction,
runs the supplied function and then COMMITs if there are no exceptions.
In case the supplied function throws an exception, this runs ROLLBACK.
In case an asynchronous exception is thrown, Hpgsql ensures a ROLLBACK
will be issued before your next query on this connection.
begin :: HPgConnection -> IO () Source #
beginMode :: HPgConnection -> IsolationLevel -> ReadWriteMode -> IO () Source #
commit :: HPgConnection -> IO () Source #
rollback :: HPgConnection -> IO () Source #
transactionStatus :: HPgConnection -> IO TransactionStatus Source #
The current transaction status.
Note that if withTransaction is interruped by an asynchronous exception,
this may still report TransActive until you run your next command.
See withTransaction for details.
data IsolationLevel Source #
Instances
data ReadWriteMode Source #
Constructors
| DefaultReadWriteMode | |
| ReadWrite | |
| ReadOnly |
Instances
data TransactionStatus Source #
Constructors
| TransActive | A command is in progress |
| TransIdle | Not inside a transaction |
| TransInTrans | Inside a transaction, but no command running |
| TransInError |
Instances
| Show TransactionStatus Source # | |
Defined in Hpgsql.TransactionStatusInternal Methods showsPrec :: Int -> TransactionStatus -> ShowS # show :: TransactionStatus -> String # showList :: [TransactionStatus] -> ShowS # | |
| Eq TransactionStatus Source # | |
Defined in Hpgsql.TransactionStatusInternal Methods (==) :: TransactionStatus -> TransactionStatus -> Bool # (/=) :: TransactionStatus -> TransactionStatus -> Bool # | |