| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Pqi
Description
A driver-agnostic reproduction of the postgresql-libpq API (version
0.11, the pipelining-capable release).
The connection is reified as a single class parameterised
over the connection type. Result accessors live in the independent
IsConnection c class, and cancellation handles in IsResult r.
IsCancel k and IsResult (ResultOf c) are superclass
constraints of IsCancel (CancelOf c), so callers who have access to a connection
get result inspection and cancellation automatically.IsConnection c
Function names, argument order, and semantics mirror the API of the C library binding
postgresql-libpq.
The only deliberate departures are:
Connection,Result, andCancelbecome the class parametercand the associated types/ResultOfc.CancelOfc- OIDs are a plain
Word32and row/column/parameter indices and LoFds are a plainInt32, rather than the C-specific newtypes of the original. - Ambiguous, rarely-useful helpers (e.g.
resStatus) are omitted,libpqVersionis omitted too. - There's no
invalidOidconstant. It's just 0. - The
unescapeByteahelper is bundled in this library and implemented natively without IO.
Synopsis
- class (IsResult (ResultOf c), IsCancel (CancelOf c)) => IsConnection c where
- type ResultOf c
- type CancelOf c
- connectdb :: ByteString -> IO c
- connectStart :: ByteString -> IO c
- connectPoll :: c -> IO PollingStatus
- newNullConnection :: IO c
- isNullConnection :: c -> Bool
- finish :: c -> IO ()
- reset :: c -> IO ()
- resetStart :: c -> IO Bool
- resetPoll :: c -> IO PollingStatus
- db :: c -> IO (Maybe ByteString)
- user :: c -> IO (Maybe ByteString)
- pass :: c -> IO (Maybe ByteString)
- host :: c -> IO (Maybe ByteString)
- port :: c -> IO (Maybe ByteString)
- options :: c -> IO (Maybe ByteString)
- status :: c -> IO ConnStatus
- transactionStatus :: c -> IO TransactionStatus
- parameterStatus :: c -> ByteString -> IO (Maybe ByteString)
- protocolVersion :: c -> IO Int
- serverVersion :: c -> IO Int
- errorMessage :: c -> IO (Maybe ByteString)
- socket :: c -> IO (Maybe Fd)
- backendPID :: c -> IO Int32
- connectionNeedsPassword :: c -> IO Bool
- connectionUsedPassword :: c -> IO Bool
- exec :: c -> ByteString -> IO (Maybe (ResultOf c))
- execParams :: c -> ByteString -> [Maybe (Word32, ByteString, Format)] -> Format -> IO (Maybe (ResultOf c))
- prepare :: c -> ByteString -> ByteString -> Maybe [Word32] -> IO (Maybe (ResultOf c))
- execPrepared :: c -> ByteString -> [Maybe (ByteString, Format)] -> Format -> IO (Maybe (ResultOf c))
- describePrepared :: c -> ByteString -> IO (Maybe (ResultOf c))
- describePortal :: c -> ByteString -> IO (Maybe (ResultOf c))
- escapeStringConn :: c -> ByteString -> IO (Maybe ByteString)
- escapeByteaConn :: c -> ByteString -> IO (Maybe ByteString)
- escapeIdentifier :: c -> ByteString -> IO (Maybe ByteString)
- sendQuery :: c -> ByteString -> IO Bool
- sendQueryParams :: c -> ByteString -> [Maybe (Word32, ByteString, Format)] -> Format -> IO Bool
- sendPrepare :: c -> ByteString -> ByteString -> Maybe [Word32] -> IO Bool
- sendQueryPrepared :: c -> ByteString -> [Maybe (ByteString, Format)] -> Format -> IO Bool
- sendDescribePrepared :: c -> ByteString -> IO Bool
- sendDescribePortal :: c -> ByteString -> IO Bool
- getResult :: c -> IO (Maybe (ResultOf c))
- consumeInput :: c -> IO Bool
- isBusy :: c -> IO Bool
- setnonblocking :: c -> Bool -> IO Bool
- isnonblocking :: c -> IO Bool
- setSingleRowMode :: c -> IO Bool
- flush :: c -> IO FlushStatus
- pipelineStatus :: c -> IO PipelineStatus
- enterPipelineMode :: c -> IO Bool
- exitPipelineMode :: c -> IO Bool
- pipelineSync :: c -> IO Bool
- sendFlushRequest :: c -> IO Bool
- getCancel :: c -> IO (Maybe (CancelOf c))
- notifies :: c -> IO (Maybe Notify)
- disableNoticeReporting :: c -> IO ()
- enableNoticeReporting :: c -> IO ()
- getNotice :: c -> IO (Maybe ByteString)
- putCopyData :: c -> ByteString -> IO CopyInResult
- putCopyEnd :: c -> Maybe ByteString -> IO CopyInResult
- getCopyData :: c -> Bool -> IO CopyOutResult
- loCreat :: c -> IO (Maybe Word32)
- loCreate :: c -> Word32 -> IO (Maybe Word32)
- loImport :: c -> FilePath -> IO (Maybe Word32)
- loImportWithOid :: c -> FilePath -> Word32 -> IO (Maybe Word32)
- loExport :: c -> Word32 -> FilePath -> IO (Maybe ())
- loOpen :: c -> Word32 -> IOMode -> IO (Maybe Int32)
- loWrite :: c -> Int32 -> ByteString -> IO (Maybe Int)
- loRead :: c -> Int32 -> Int -> IO (Maybe ByteString)
- loSeek :: c -> Int32 -> SeekMode -> Int -> IO (Maybe Int)
- loTell :: c -> Int32 -> IO (Maybe Int)
- loTruncate :: c -> Int32 -> Int -> IO (Maybe ())
- loClose :: c -> Int32 -> IO (Maybe ())
- loUnlink :: c -> Word32 -> IO (Maybe ())
- clientEncoding :: c -> IO ByteString
- setClientEncoding :: c -> ByteString -> IO Bool
- setErrorVerbosity :: c -> Verbosity -> IO Verbosity
- class IsResult r where
- resultStatus :: r -> IO ExecStatus
- resultErrorMessage :: r -> IO (Maybe ByteString)
- resultErrorField :: r -> FieldCode -> IO (Maybe ByteString)
- unsafeFreeResult :: r -> IO ()
- ntuples :: r -> IO Int32
- nfields :: r -> IO Int32
- fname :: r -> Int32 -> IO (Maybe ByteString)
- fnumber :: r -> ByteString -> IO (Maybe Int32)
- ftable :: r -> Int32 -> IO Word32
- ftablecol :: r -> Int32 -> IO Int32
- fformat :: r -> Int32 -> IO Format
- ftype :: r -> Int32 -> IO Word32
- fmod :: r -> Int32 -> IO Int
- fsize :: r -> Int32 -> IO Int
- getvalue :: r -> Int32 -> Int32 -> IO (Maybe ByteString)
- getvalue' :: r -> Int32 -> Int32 -> IO (Maybe ByteString)
- getisnull :: r -> Int32 -> Int32 -> IO Bool
- getlength :: r -> Int32 -> Int32 -> IO Int
- nparams :: r -> IO Int32
- paramtype :: r -> Int32 -> IO Word32
- cmdStatus :: r -> IO (Maybe ByteString)
- cmdTuples :: r -> IO (Maybe ByteString)
- class IsCancel k where
- cancel :: k -> IO (Either ByteString ())
- data Format
- data ExecStatus
- data ConnStatus
- data TransactionStatus
- data PollingStatus
- data PipelineStatus
- data FieldCode
- data Verbosity
- data FlushStatus
- data CopyInResult
- data CopyOutResult
- data Notify = Notify {
- relname :: ByteString
- bePid :: Int32
- extra :: ByteString
- unescapeBytea :: ByteString -> ByteString
Type classes
class (IsResult (ResultOf c), IsCancel (CancelOf c)) => IsConnection c where Source #
The single flat capability class: establishing, closing, inspecting, querying, escaping, async commands, pipelining, cancellation handle creation, notifications, copy, large objects, and control.
See the individual capability-class documentation (now inlined below) for semantics of each method.
Associated Types
The result type produced by this connection.
The cancellation-handle type produced by this connection.
Methods
connectdb :: ByteString -> IO c Source #
Make a new (blocking) connection from a conninfo string.
connectStart :: ByteString -> IO c Source #
Begin establishing a connection asynchronously.
connectPoll :: c -> IO PollingStatus Source #
Drive an asynchronous connection attempt forward.
newNullConnection :: IO c Source #
A sentinel "null" connection.
isNullConnection :: c -> Bool Source #
Whether a connection is the null sentinel.
Close the connection and release its resources.
Reset the communication channel to the server (blocking).
resetStart :: c -> IO Bool Source #
Begin resetting the connection asynchronously.
resetPoll :: c -> IO PollingStatus Source #
Drive an asynchronous reset forward.
db :: c -> IO (Maybe ByteString) Source #
The database name of the connection.
user :: c -> IO (Maybe ByteString) Source #
The user name of the connection.
pass :: c -> IO (Maybe ByteString) Source #
The password of the connection.
host :: c -> IO (Maybe ByteString) Source #
The server host name of the connection.
port :: c -> IO (Maybe ByteString) Source #
The port of the connection.
options :: c -> IO (Maybe ByteString) Source #
The command-line options passed in the connection request.
status :: c -> IO ConnStatus Source #
Current connection status.
transactionStatus :: c -> IO TransactionStatus Source #
Current in-transaction status of the server.
parameterStatus :: c -> ByteString -> IO (Maybe ByteString) Source #
Look up a current parameter setting reported by the server.
protocolVersion :: c -> IO Int Source #
The frontend/backend protocol version.
serverVersion :: c -> IO Int Source #
The server version, as an integer of the form MMmmpp.
errorMessage :: c -> IO (Maybe ByteString) Source #
The most recent error message, if any.
Note: unlike the structured fields available via , the
flat message text is formatted locally by the driver, so adapters are not
expected to produce byte-identical strings.resultErrorField
socket :: c -> IO (Maybe Fd) Source #
The file descriptor of the connection socket.
backendPID :: c -> IO Int32 Source #
The process ID of the backend serving this connection.
connectionNeedsPassword :: c -> IO Bool Source #
Whether the connection authentication method required a password but none was available.
connectionUsedPassword :: c -> IO Bool Source #
Whether the connection authentication used a password.
exec :: c -> ByteString -> IO (Maybe (ResultOf c)) Source #
Submit a command and wait for the result.
execParams :: c -> ByteString -> [Maybe (Word32, ByteString, Format)] -> Format -> IO (Maybe (ResultOf c)) Source #
Submit a parameterized command. Each parameter is given as
(type oid, value, format), or for SQL NothingNULL. The final
selects the result format.Format
prepare :: c -> ByteString -> ByteString -> Maybe [Word32] -> IO (Maybe (ResultOf c)) Source #
Prepare a named statement. The OID list, when supplied, fixes parameter
types; leaves them to be inferred.Nothing
execPrepared :: c -> ByteString -> [Maybe (ByteString, Format)] -> Format -> IO (Maybe (ResultOf c)) Source #
Execute a previously prepared statement. Each parameter is
(value, format), or for SQL NothingNULL.
describePrepared :: c -> ByteString -> IO (Maybe (ResultOf c)) Source #
Describe a prepared statement.
describePortal :: c -> ByteString -> IO (Maybe (ResultOf c)) Source #
Describe a portal.
escapeStringConn :: c -> ByteString -> IO (Maybe ByteString) Source #
Escape a string for safe inclusion in an SQL literal.
escapeByteaConn :: c -> ByteString -> IO (Maybe ByteString) Source #
Escape binary data for use within a bytea literal.
escapeIdentifier :: c -> ByteString -> IO (Maybe ByteString) Source #
Escape a string for use as an SQL identifier (e.g. a table or column name), including the surrounding double quotes.
sendQuery :: c -> ByteString -> IO Bool Source #
Submit a command without waiting for the result.
sendQueryParams :: c -> ByteString -> [Maybe (Word32, ByteString, Format)] -> Format -> IO Bool Source #
Asynchronous .execParams
sendPrepare :: c -> ByteString -> ByteString -> Maybe [Word32] -> IO Bool Source #
Asynchronous .prepare
sendQueryPrepared :: c -> ByteString -> [Maybe (ByteString, Format)] -> Format -> IO Bool Source #
Asynchronous .execPrepared
sendDescribePrepared :: c -> ByteString -> IO Bool Source #
Asynchronous .describePrepared
sendDescribePortal :: c -> ByteString -> IO Bool Source #
Asynchronous .describePortal
getResult :: c -> IO (Maybe (ResultOf c)) Source #
Collect the next result from an asynchronous command.
consumeInput :: c -> IO Bool Source #
Read input from the server into the driver's buffer.
isBusy :: c -> IO Bool Source #
Whether a command is busy (a would block).getResult
setnonblocking :: c -> Bool -> IO Bool Source #
Set the non-blocking flag of the connection.
isnonblocking :: c -> IO Bool Source #
Whether the connection is in non-blocking mode.
setSingleRowMode :: c -> IO Bool Source #
Select single-row mode for the currently executing query.
flush :: c -> IO FlushStatus Source #
Flush queued output data to the server.
pipelineStatus :: c -> IO PipelineStatus Source #
Current pipeline-mode status.
enterPipelineMode :: c -> IO Bool Source #
Enter pipeline mode.
exitPipelineMode :: c -> IO Bool Source #
Leave pipeline mode.
pipelineSync :: c -> IO Bool Source #
Mark a synchronization point in a pipeline.
sendFlushRequest :: c -> IO Bool Source #
Request the server to flush its output buffer in pipeline mode.
getCancel :: c -> IO (Maybe (CancelOf c)) Source #
Obtain a cancellation handle for the connection.
notifies :: c -> IO (Maybe Notify) Source #
Return the next notification from the queue, if any.
disableNoticeReporting :: c -> IO () Source #
Stop accumulating notices for retrieval via .getNotice
enableNoticeReporting :: c -> IO () Source #
Start accumulating notices for retrieval via .getNotice
getNotice :: c -> IO (Maybe ByteString) Source #
Retrieve the next accumulated notice, if any.
putCopyData :: c -> ByteString -> IO CopyInResult Source #
Send data on a COPY FROM STDIN connection.
putCopyEnd :: c -> Maybe ByteString -> IO CopyInResult Source #
Signal the end of COPY FROM STDIN; aborts with the given error.Just
getCopyData :: c -> Bool -> IO CopyOutResult Source #
Receive data on a COPY TO STDOUT connection. The selects
non-blocking mode.Bool
loCreat :: c -> IO (Maybe Word32) Source #
Create a new large object.
loCreate :: c -> Word32 -> IO (Maybe Word32) Source #
Create a new large object with the given OID.
loImport :: c -> FilePath -> IO (Maybe Word32) Source #
Import a file as a new large object.
loImportWithOid :: c -> FilePath -> Word32 -> IO (Maybe Word32) Source #
Import a file as a new large object with the given OID.
loExport :: c -> Word32 -> FilePath -> IO (Maybe ()) Source #
Export a large object to a file.
loOpen :: c -> Word32 -> IOMode -> IO (Maybe Int32) Source #
Open a large object.
loWrite :: c -> Int32 -> ByteString -> IO (Maybe Int) Source #
Write to an open large object.
loRead :: c -> Int32 -> Int -> IO (Maybe ByteString) Source #
Read from an open large object.
loSeek :: c -> Int32 -> SeekMode -> Int -> IO (Maybe Int) Source #
Seek within an open large object.
loTell :: c -> Int32 -> IO (Maybe Int) Source #
Report the current seek position of an open large object.
loTruncate :: c -> Int32 -> Int -> IO (Maybe ()) Source #
Truncate an open large object.
loClose :: c -> Int32 -> IO (Maybe ()) Source #
Close an open large object.
loUnlink :: c -> Word32 -> IO (Maybe ()) Source #
Remove a large object.
clientEncoding :: c -> IO ByteString Source #
The current client encoding name.
setClientEncoding :: c -> ByteString -> IO Bool Source #
Set the client encoding.
setErrorVerbosity :: c -> Verbosity -> IO Verbosity Source #
Set error verbosity, returning the previous setting.
class IsResult r where Source #
Result-accessor methods, independent of the connection type that produced
the result. This allows row decoders and projection functions (such as
observeResult in pqi-conformance) to operate on any result type
without knowing the originating connection.
Minimal complete definition
resultStatus, resultErrorMessage, resultErrorField, unsafeFreeResult, ntuples, nfields, fname, fnumber, ftable, ftablecol, fformat, ftype, fmod, fsize, getvalue', getisnull, getlength, nparams, paramtype, cmdStatus, cmdTuples
Methods
resultStatus :: r -> IO ExecStatus Source #
The status of the result.
resultErrorMessage :: r -> IO (Maybe ByteString) Source #
The flat error message associated with the result, if any. Best-effort;
see the note on errorMessage.
resultErrorField :: r -> FieldCode -> IO (Maybe ByteString) Source #
A single structured field of the result's error report.
unsafeFreeResult :: r -> IO () Source #
Free the result. Adapters that manage results with the garbage collector
may implement this as a no-op; for the C-backed adapter it frees the
underlying PGresult, after which the result must not be used.
ntuples :: r -> IO Int32 Source #
Number of rows (tuples) in the result.
nfields :: r -> IO Int32 Source #
Number of columns (fields) in the result.
fname :: r -> Int32 -> IO (Maybe ByteString) Source #
Name of the column at the given index.
fnumber :: r -> ByteString -> IO (Maybe Int32) Source #
Index of the column with the given name, if present.
ftable :: r -> Int32 -> IO Word32 Source #
OID of the table the given column was fetched from, or 0.
ftablecol :: r -> Int32 -> IO Int32 Source #
Column number (within its table) that the given result column was fetched from, or 0.
fformat :: r -> Int32 -> IO Format Source #
Format (text or binary) of the given column.
ftype :: r -> Int32 -> IO Word32 Source #
Data type OID of the given column.
fmod :: r -> Int32 -> IO Int Source #
Type modifier of the given column.
fsize :: r -> Int32 -> IO Int Source #
Server-side storage size of the given column's type, or a negative value for variable size.
getvalue :: r -> Int32 -> Int32 -> IO (Maybe ByteString) Source #
Value at (row, column), or for SQL NothingNULL. Delegates to
by default in case the adapter provides a copying variant.getvalue'
getvalue' :: r -> Int32 -> Int32 -> IO (Maybe ByteString) Source #
Like getvalue, but always returns a copy that remains valid after the
result is freed.
getisnull :: r -> Int32 -> Int32 -> IO Bool Source #
Whether the value at (row, column) is SQL NULL.
getlength :: r -> Int32 -> Int32 -> IO Int Source #
Length in bytes of the value at (row, column).
nparams :: r -> IO Int32 Source #
Number of parameters of a prepared statement (for a describePrepared
result).
paramtype :: r -> Int32 -> IO Word32 Source #
Data type OID of the given prepared-statement parameter.
cmdStatus :: r -> IO (Maybe ByteString) Source #
The command status tag of the result (e.g. "INSERT 0 1").
cmdTuples :: r -> IO (Maybe ByteString) Source #
The number of rows affected by the command, as text.
class IsCancel k where Source #
Cancellation of in-progress commands, isolated from the connection type.
Shared types
Format of a parameter or result column: textual or binary.
data ExecStatus Source #
Status of a command result, as reported by PQresultStatus.
Constructors
| EmptyQuery | The string sent to the server was empty. |
| CommandOk | Successful completion of a command returning no data. |
| TuplesOk | Successful completion of a command returning data (such as a
|
| CopyOut | Copy Out (from server) data transfer started. |
| CopyIn | Copy In (to server) data transfer started. |
| CopyBoth | Copy In/Out data transfer started. |
| BadResponse | The server's response was not understood. |
| NonfatalError | A nonfatal error (a notice or warning) occurred. |
| FatalError | A fatal error occurred. |
| SingleTuple | The |
| PipelineSync | The |
| PipelineAbort | The |
Instances
| Eq ExecStatus Source # | |
Defined in Pqi | |
| Ord ExecStatus Source # | |
Defined in Pqi Methods compare :: ExecStatus -> ExecStatus -> Ordering # (<) :: ExecStatus -> ExecStatus -> Bool # (<=) :: ExecStatus -> ExecStatus -> Bool # (>) :: ExecStatus -> ExecStatus -> Bool # (>=) :: ExecStatus -> ExecStatus -> Bool # max :: ExecStatus -> ExecStatus -> ExecStatus # min :: ExecStatus -> ExecStatus -> ExecStatus # | |
| Bounded ExecStatus Source # | |
Defined in Pqi | |
| Enum ExecStatus Source # | |
Defined in Pqi Methods succ :: ExecStatus -> ExecStatus # pred :: ExecStatus -> ExecStatus # toEnum :: Int -> ExecStatus # fromEnum :: ExecStatus -> Int # enumFrom :: ExecStatus -> [ExecStatus] # enumFromThen :: ExecStatus -> ExecStatus -> [ExecStatus] # enumFromTo :: ExecStatus -> ExecStatus -> [ExecStatus] # enumFromThenTo :: ExecStatus -> ExecStatus -> ExecStatus -> [ExecStatus] # | |
| Show ExecStatus Source # | |
Defined in Pqi Methods showsPrec :: Int -> ExecStatus -> ShowS # show :: ExecStatus -> String # showList :: [ExecStatus] -> ShowS # | |
data ConnStatus Source #
Status of a connection, as reported by PQstatus.
Constructors
| ConnectionOk | The connection is ready. |
| ConnectionBad | The connection procedure has failed. |
| ConnectionStarted | Waiting for connection to be made. |
| ConnectionMade | Connection OK; waiting to send. |
| ConnectionAwaitingResponse | Waiting for a response from the server. |
| ConnectionAuthOk | Received authentication; waiting for backend start-up to finish. |
| ConnectionSetEnv | Negotiating environment-driven parameter settings. |
| ConnectionSSLStartup | Negotiating SSL encryption. |
Instances
| Eq ConnStatus Source # | |
Defined in Pqi | |
| Ord ConnStatus Source # | |
Defined in Pqi Methods compare :: ConnStatus -> ConnStatus -> Ordering # (<) :: ConnStatus -> ConnStatus -> Bool # (<=) :: ConnStatus -> ConnStatus -> Bool # (>) :: ConnStatus -> ConnStatus -> Bool # (>=) :: ConnStatus -> ConnStatus -> Bool # max :: ConnStatus -> ConnStatus -> ConnStatus # min :: ConnStatus -> ConnStatus -> ConnStatus # | |
| Bounded ConnStatus Source # | |
Defined in Pqi | |
| Enum ConnStatus Source # | |
Defined in Pqi Methods succ :: ConnStatus -> ConnStatus # pred :: ConnStatus -> ConnStatus # toEnum :: Int -> ConnStatus # fromEnum :: ConnStatus -> Int # enumFrom :: ConnStatus -> [ConnStatus] # enumFromThen :: ConnStatus -> ConnStatus -> [ConnStatus] # enumFromTo :: ConnStatus -> ConnStatus -> [ConnStatus] # enumFromThenTo :: ConnStatus -> ConnStatus -> ConnStatus -> [ConnStatus] # | |
| Show ConnStatus Source # | |
Defined in Pqi Methods showsPrec :: Int -> ConnStatus -> ShowS # show :: ConnStatus -> String # showList :: [ConnStatus] -> ShowS # | |
data TransactionStatus Source #
Current in-transaction status of the server, as reported by
PQtransactionStatus.
Constructors
| TransIdle | Currently idle. |
| TransActive | A command is in progress. |
| TransInTrans | Idle, within a transaction block. |
| TransInError | Idle, within a failed transaction. |
| TransUnknown | Connection is bad. |
Instances
data PollingStatus Source #
Result of a non-blocking connection-polling step.
Constructors
| PollingFailed | |
| PollingReading | |
| PollingWriting | |
| PollingOk |
Instances
data PipelineStatus Source #
Pipeline-mode status of a connection, as reported by PQpipelineStatus.
Constructors
| PipelineOn | The connection is in pipeline mode. |
| PipelineOff | The connection is not in pipeline mode. |
| PipelineAborted | The connection is in pipeline mode and an error occurred while processing the current pipeline. |
Instances
Field identifier for the structured fields of an error report, as accepted
by PQresultErrorField.
Constructors
Instances
| Eq FieldCode Source # | |
| Ord FieldCode Source # | |
| Bounded FieldCode Source # | |
| Enum FieldCode Source # | |
Defined in Pqi Methods succ :: FieldCode -> FieldCode # pred :: FieldCode -> FieldCode # fromEnum :: FieldCode -> Int # enumFrom :: FieldCode -> [FieldCode] # enumFromThen :: FieldCode -> FieldCode -> [FieldCode] # enumFromTo :: FieldCode -> FieldCode -> [FieldCode] # enumFromThenTo :: FieldCode -> FieldCode -> FieldCode -> [FieldCode] # | |
| Show FieldCode Source # | |
Verbosity of error reporting, as set by PQsetErrorVerbosity.
Constructors
| ErrorsTerse | |
| ErrorsDefault | |
| ErrorsVerbose |
Instances
| Eq Verbosity Source # | |
| Ord Verbosity Source # | |
| Bounded Verbosity Source # | |
| Enum Verbosity Source # | |
Defined in Pqi Methods succ :: Verbosity -> Verbosity # pred :: Verbosity -> Verbosity # fromEnum :: Verbosity -> Int # enumFrom :: Verbosity -> [Verbosity] # enumFromThen :: Verbosity -> Verbosity -> [Verbosity] # enumFromTo :: Verbosity -> Verbosity -> [Verbosity] # enumFromThenTo :: Verbosity -> Verbosity -> Verbosity -> [Verbosity] # | |
| Show Verbosity Source # | |
data FlushStatus Source #
Result of attempting to flush the output buffer in non-blocking mode.
Constructors
| FlushOk | |
| FlushFailed | |
| FlushWriting |
Instances
data CopyInResult Source #
Result of PQputCopyData/PQputCopyEnd.
Constructors
| CopyInOk | |
| CopyInError | |
| CopyInWouldBlock |
Instances
data CopyOutResult Source #
Result of PQgetCopyData.
Constructors
| CopyOutRow ByteString | |
| CopyOutWouldBlock | |
| CopyOutDone | |
| CopyOutError |
Instances
| Eq CopyOutResult Source # | |
Defined in Pqi Methods (==) :: CopyOutResult -> CopyOutResult -> Bool # (/=) :: CopyOutResult -> CopyOutResult -> Bool # | |
| Ord CopyOutResult Source # | |
Defined in Pqi Methods compare :: CopyOutResult -> CopyOutResult -> Ordering # (<) :: CopyOutResult -> CopyOutResult -> Bool # (<=) :: CopyOutResult -> CopyOutResult -> Bool # (>) :: CopyOutResult -> CopyOutResult -> Bool # (>=) :: CopyOutResult -> CopyOutResult -> Bool # max :: CopyOutResult -> CopyOutResult -> CopyOutResult # min :: CopyOutResult -> CopyOutResult -> CopyOutResult # | |
| Show CopyOutResult Source # | |
Defined in Pqi Methods showsPrec :: Int -> CopyOutResult -> ShowS # show :: CopyOutResult -> String # showList :: [CopyOutResult] -> ShowS # | |
An asynchronous notification, as returned by notifies.
Constructors
| Notify | |
Fields
| |
Connection-independent helpers
unescapeBytea :: ByteString -> ByteString Source #
Convert the textual representation of a bytea value, as produced by
the server, back into raw bytes. Both the modern \x hex format (lowercase
x only) and the legacy escape format are accepted.
Malformed input is tolerated exactly the way PQunescapeBytea tolerates it:
in hex format, characters that are not hex digits (including whitespace) are
silently skipped, and a hex digit whose pair character is invalid is
dropped; in escape format, an invalid escape simply drops the backslash, and
an octal escape must start with 0..3. Input is treated as a C string:
the first NUL byte terminates processing.