Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Low-level functions for executing SqlExpression
values directly.
Since: 1.0.0.0
Synopsis
- executeAndDecode :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> AnnotatedSqlMarshaller writeEntity readEntity -> m [readEntity]
- executeAndReturnAffectedRows :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> m Int
- executeVoid :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> m ()
- executeAndDecodeIO :: SqlExpression sql => QueryType -> sql -> AnnotatedSqlMarshaller writeEntity readEntity -> OrvilleState -> Connection -> IO [readEntity]
- executeAndReturnAffectedRowsIO :: SqlExpression sql => QueryType -> sql -> OrvilleState -> Connection -> IO Int
- executeVoidIO :: SqlExpression sql => QueryType -> sql -> OrvilleState -> Connection -> IO ()
- data AffectedRowsDecodingError
Documentation
executeAndDecode :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> AnnotatedSqlMarshaller writeEntity readEntity -> m [readEntity] Source #
Executes a SQL query and decodes the result set using the provided
marshaller. Any SQL Execution callbacks that have been added to the
OrvilleState
will be called.
If the query fails or if any row is unable to be decoded by the marshaller, an exception will be raised.
Since: 1.0.0.0
executeAndReturnAffectedRows :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> m Int Source #
Executes a SQL query and returns the number of rows affected by the query.
Any SQL Execution callbacks that have been added to the OrvilleState
will
be called.
This function can only be used for the execution of a SELECT, CREATE
TABLE AS, INSERT, UPDATE, DELETE, MOVE, FETCH, or COPY statement, or an
EXECUTE of a prepared query that contains an INSERT, UPDATE, or DELETE
statement. If the query is anything else, an AffectedRowsDecodingError
wil be raised after the query is executed when the result is read.
If the query fails, an exception will be raised.
Since: 1.0.0.0
executeVoid :: (MonadOrville m, SqlExpression sql) => QueryType -> sql -> m () Source #
Executes a SQL query and ignores the result. Any SQL Execution callbacks
that have been added to the OrvilleState
will be called.
If the query fails an exception will be raised.
Since: 1.0.0.0
executeAndDecodeIO :: SqlExpression sql => QueryType -> sql -> AnnotatedSqlMarshaller writeEntity readEntity -> OrvilleState -> Connection -> IO [readEntity] Source #
Executes a SQL query and decodes the result set using the provided
marshaller. Any SQL Execution callbacks that have been added to the
OrvilleState
will be called.
If the query fails or if any row is unable to be decoded by the marshaller, an exception will be raised.
Since: 1.0.0.0
executeAndReturnAffectedRowsIO :: SqlExpression sql => QueryType -> sql -> OrvilleState -> Connection -> IO Int Source #
Executes a SQL query and returns the number of rows affected by the query.
Any SQL Execution callbacks that have been added to the OrvilleState
will
be called.
This function can only be used for the execution of a SELECT, CREATE
TABLE AS, INSERT, UPDATE, DELETE, MOVE, FETCH, or COPY statement, or an
EXECUTE of a prepared query that contains an INSERT, UPDATE, or DELETE
statement. If the query is anything else, an AffectedRowsDecodingError
wil be raised after the query is executed when the result is read.
If the query fails, an exception will be raised.
Since: 1.0.0.0
executeVoidIO :: SqlExpression sql => QueryType -> sql -> OrvilleState -> Connection -> IO () Source #
Executes a SQL query and ignores the result. Any SQL Execution callbacks
that have been added to the OrvilleState
will be called.
If the query fails, an exception will be raised.
Since: 1.0.0.0
data AffectedRowsDecodingError Source #
Thrown by executeAndReturnAffectedRows
and executeAndReturnAffectedRowsIO
if the number of affected rows cannot be successfully read from the LibPQ
command result.
Since: 1.0.0.0
Instances
Exception AffectedRowsDecodingError Source # | Since: 1.0.0.0 |
Show AffectedRowsDecodingError Source # | Since: 1.0.0.0 |
Defined in Orville.PostgreSQL.Execution.Execute showsPrec :: Int -> AffectedRowsDecodingError -> ShowS # show :: AffectedRowsDecodingError -> String # showList :: [AffectedRowsDecodingError] -> ShowS # |