hpgsql
Safe HaskellNone
LanguageHaskell2010

Hpgsql.Transaction

Synopsis

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.

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

Instances details
Bounded IsolationLevel Source # 
Instance details

Defined in Hpgsql.Transaction

Enum IsolationLevel Source # 
Instance details

Defined in Hpgsql.Transaction

Show IsolationLevel Source # 
Instance details

Defined in Hpgsql.Transaction

Eq IsolationLevel Source # 
Instance details

Defined in Hpgsql.Transaction

Ord IsolationLevel Source # 
Instance details

Defined in Hpgsql.Transaction

data ReadWriteMode Source #

data TransactionStatus Source #

Constructors

TransActive

A command is in progress

TransIdle

Not inside a transaction

TransInTrans

Inside a transaction, but no command running

TransInError