orville-postgresql-1.0.0.0: A Haskell library for PostgreSQL
CopyrightFlipstone Technology Partners 2023
LicenseMIT
StabilityStable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Orville.PostgreSQL.Execution.Execute

Description

Low-level functions for executing SqlExpression values directly.

Since: 1.0.0.0

Synopsis

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