hpqtypes-1.6.0.0: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes.Transaction

Synopsis

Documentation

newtype Savepoint Source #

Wrapper that represents savepoint name.

Constructors

Savepoint (RawSQL ()) 

withSavepoint :: (MonadDB m, MonadMask m) => Savepoint -> m a -> m a Source #

Create a savepoint and roll back to it if given monadic action throws. This may only be used if a transaction is already active. Note that it provides something like "nested transaction".

See http://www.postgresql.org/docs/current/static/sql-savepoint.html

withTransaction :: (MonadDB m, MonadMask m) => m a -> m a Source #

Same as withTransaction' except that it uses current transaction settings instead of custom ones. It is worth noting that changing transaction settings inside supplied monadic action won't have any effect on the final commit / rollback as settings that were in effect during the call to withTransaction will be used.

begin :: MonadDB m => m () Source #

Begin transaction using current transaction settings.

commit :: MonadDB m => m () Source #

Commit active transaction using current transaction settings.

rollback :: MonadDB m => m () Source #

Rollback active transaction using current transaction settings.

withTransaction' :: (MonadDB m, MonadMask m) => TransactionSettings -> m a -> m a Source #

Execute monadic action within a transaction using given transaction settings. Note that it won't work as expected if a transaction is already active (in such case withSavepoint should be used instead).

begin' :: MonadDB m => TransactionSettings -> m () Source #

Begin transaction using given transaction settings.

commit' :: MonadDB m => TransactionSettings -> m () Source #

Commit active transaction using given transaction settings.

rollback' :: MonadDB m => TransactionSettings -> m () Source #

Rollback active transaction using given transaction settings.