Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype Savepoint = Savepoint (RawSQL ())
- withSavepoint :: (MonadDB m, MonadMask m) => Savepoint -> m a -> m a
- withTransaction :: (MonadDB m, MonadMask m) => m a -> m a
- begin :: MonadDB m => m ()
- commit :: MonadDB m => m ()
- rollback :: MonadDB m => m ()
- withTransaction' :: (MonadDB m, MonadMask m) => TransactionSettings -> m a -> m a
- begin' :: MonadDB m => TransactionSettings -> m ()
- commit' :: MonadDB m => TransactionSettings -> m ()
- rollback' :: MonadDB m => TransactionSettings -> m ()
Documentation
Wrapper that represents savepoint name.
Instances
IsString Savepoint Source # | |
Defined in Database.PostgreSQL.PQTypes.Transaction fromString :: String -> Savepoint # |
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.
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.