Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Since: 1.0.0.0
Synopsis
- data ConnectionOptions = ConnectionOptions {}
- data NoticeReporting
- data MaxConnections
- data StripeOption
- data ConnectionPool
- createConnectionPool :: ConnectionOptions -> IO ConnectionPool
- data Connection
- withPoolConnection :: ConnectionPool -> (Connection -> IO a) -> IO a
- executeRaw :: Connection -> ByteString -> [Maybe PgTextFormatValue] -> IO Result
- quoteStringLiteral :: Connection -> ByteString -> IO Builder
- quoteIdentifier :: Connection -> ByteString -> IO Builder
- data ConnectionUsedAfterCloseError
- data ConnectionError
- data SqlExecutionError = SqlExecutionError {}
Documentation
data ConnectionOptions Source #
Configuration options to pass to createConnectionPool
to specify the
parameters for the pool and the connections that it creates.
Since: 1.0.0.0
ConnectionOptions | |
|
data NoticeReporting Source #
An option for createConnectionPool
that indicates whether LibPQ should
print notice reports for warnings to the console.
Since: 1.0.0.0
data MaxConnections Source #
Values for the connectionMaxConnections
field of ConnectionOptions
.
Since: 1.0.0.0
MaxConnectionsTotal Int |
|
MaxConnectionsPerStripe Int |
|
data StripeOption Source #
Values for the connectionPoolStripes
field of ConnectionOptions
.
Since: 1.0.0.0
OneStripePerCapability |
|
StripeCount Int |
|
data ConnectionPool Source #
Orville always uses a connection pool to manage the number of open connections
to the database. See ConnectionConfig
and createConnectionPool
to find how
to create a ConnectionPool
.
Since: 1.0.0.0
createConnectionPool :: ConnectionOptions -> IO ConnectionPool Source #
createConnectionPool
allocates a pool of connections to a PostgreSQL server.
Since: 1.0.0.0
data Connection Source #
An Orville handler for a LibPQ connection.
Since: 1.0.0.0
withPoolConnection :: ConnectionPool -> (Connection -> IO a) -> IO a Source #
Allocates a connection from the pool and performs an action with it. This function will block if the maximum number of connections is reached.
Since: 1.0.0.0
executeRaw :: Connection -> ByteString -> [Maybe PgTextFormatValue] -> IO Result Source #
executeRaw
runs a given SQL statement returning the raw underlying result.
All handling of stepping through the result set is left to the caller. This potentially leaves connections open much longer than one would expect if all of the results are not iterated through immediately *and* the data copied. Use with caution.
Since: 1.0.0.0
quoteStringLiteral :: Connection -> ByteString -> IO Builder Source #
Escapes and quotes a string for use as a literal within a SQL command that
will be executed on the given connection. This uses the PQescapeStringConn
function from LibPQ, which takes the character encoding of the connection
into account. Note that while PQescapeStringConn
does not surround the
literal with quotes, this function does for the sake of symmetry with
quoteIdentifier
.
This function returns a Builder
so that the result can be included in
a builder being constructed for the surrounding SQL command without making
an additional copy of the ByteString
returned by LibPQ for the sake of
adding the surrounding quotes.
Since: 1.0.0.0
quoteIdentifier :: Connection -> ByteString -> IO Builder Source #
Escapes and quotes a string for use as an identifier within a SQL command
that will be executed on the given connection. This uses the
PQescapeIdentifier
function from LibPQ, which takes the character encoding
of the connection into account and also applies the quotes.
Although this function does not need to copy the ByteString
returned by
LibPQ to add the quotes (since LibPQ already added them), it returns a
Builder
nonetheless to maintain symmetry with quoteStringLiteral
.
Since: 1.0.0.0
data ConnectionUsedAfterCloseError Source #
Orville throws as ConnectionUsedAfterCloseError
if it attempts to use a
Connection
value after it has already been closed. If this occurs, it is a
bug in Orville.
Since: 1.0.0.0
Instances
data ConnectionError Source #
Orville throws a ConnectionError
on an error reported by the underlying
LibPQ connection that does not come directly from executing SQL. This could
could represent an inability to open a new database connection, but could
also represent other errors such as an error while quoting a database
identifier.
Since: 1.0.0.0
Instances
Exception ConnectionError Source # | |
Defined in Orville.PostgreSQL.Raw.Connection | |
Show ConnectionError Source # | |
Defined in Orville.PostgreSQL.Raw.Connection showsPrec :: Int -> ConnectionError -> ShowS # show :: ConnectionError -> String # showList :: [ConnectionError] -> ShowS # |
data SqlExecutionError Source #
Orville throws a SqlExecutionError
when an error is reported by the
underlying LibPQ connection during an attempt to execute SQL.
Since: 1.0.0.0
SqlExecutionError | |
|
Instances
Exception SqlExecutionError Source # | |
Show SqlExecutionError Source # | |
Defined in Orville.PostgreSQL.Raw.Connection showsPrec :: Int -> SqlExecutionError -> ShowS # show :: SqlExecutionError -> String # showList :: [SqlExecutionError] -> ShowS # |