hpqtypes-1.2.4: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell98

Database.PostgreSQL.PQTypes.Class

Documentation

class (Applicative m, Monad m) => MonadDB m where Source

Methods

runQuery :: IsSQL sql => sql -> m Int Source

Run SQL query and return number of affected/returned rows. Note that for a given connection, only one thread may be executing runQuery at a given time. If simultaneous call is made from another thread, it will block until currently running runQuery finishes.

getLastQuery :: m SomeSQL Source

Get last SQL query that was executed.

getConnectionStats :: m ConnectionStats Source

Get current connection statistics.

getQueryResult :: m (Maybe QueryResult) Source

Get current query result.

clearQueryResult :: m () Source

Clear current query result.

getTransactionSettings :: m TransactionSettings Source

Get current transaction settings.

setTransactionSettings :: TransactionSettings -> m () Source

Set transaction settings to supplied ones. Note that it won't change any properties of currently running transaction, only the subsequent ones.

foldlM :: FromRow row => (acc -> row -> m acc) -> acc -> m acc Source

Fold the result set of rows from left to right.

foldrM :: FromRow row => (row -> acc -> m acc) -> acc -> m acc Source

Fold the result set of rows from right to left.

withNewConnection :: m a -> m a Source

Execute supplied monadic action with new connection using current connection source and transaction settings.

Particularly useful when you want to spawn a new thread, but do not want the connection in child thread to be shared with the parent one.

Instances

(Applicative (t m), Monad (t m), MonadTrans t, MonadTransControl t, MonadDB m) => MonadDB (t m) 
MonadDB m => MonadDB (ListT m) 
MonadDB m => MonadDB (MaybeT m) 
MonadDB m => MonadDB (IdentityT m) 
(MonadBase IO m, MonadMask m) => MonadDB (DBT m) 
(Error e, MonadDB m) => MonadDB (ErrorT e m) 
MonadDB m => MonadDB (ReaderT r m) 
MonadDB m => MonadDB (StateT s m) 
MonadDB m => MonadDB (StateT s m) 
(Monoid w, MonadDB m) => MonadDB (WriterT w m) 
(Monoid w, MonadDB m) => MonadDB (WriterT w m) 
(Monoid w, MonadDB m) => MonadDB (RWST r w s m) 
(Monoid w, MonadDB m) => MonadDB (RWST r w s m)