The connection to the PostgreSQL server.
See the General Usage page for an introduction on how to use this class.
int
$status#int
$transactionStatus#resource
$socket#resource
.bool
$busy#string
$errorMessage#array
$eventHandlers#string
$encoding# = NULL
bool
$unbuffered# = FALSE
bool
$nonblocking# = FALSE
string
$db#string
$user#string
$pass#string
$host#string
$port#string
$options#int
$defaultFetchType# = pq\Result::FETCH_ARRAYint
$defaultAutoConvert# = pq\Result::CONV_ALLint
$defaultTransactionIsolation# = pq\Transaction::READ_COMMITTEDbool
$defaultTransactionReadonly# = FALSE
bool
$defaultTransactionDeferrable# = FALSE
Create a new PostgreSQL connection.
void
pq\Connection::__construct([string
$dsn = ""[, int
$flags = 0]])
Declare a cursor for a query.
pq\Cursor pq\Connection::declare(string
$name, int
$flags, string
$query)
Asynchronously declare a cursor for a query.
pq\Cursor pq\Connection::declareAsync(string
$name, int
$flags, string
$query)
Escape binary data for use within a query with the type bytea.
string
pq\Connection::escapeBytea(string
$binary)
Execute one or multiple SQL queries on the connection.
pq\Result pq\Connection::exec(string
$query)
Asynchronously execute an SQL query on the connection.
void
pq\Connection::exec(string
$query[, callable
$callback])
Execute an SQL query with properly escaped parameters substituted.
pq\Result pq\Connection::execParams(string
$query, array
$params[, array
$types = NULL
])
Asynchronously execute an SQL query with properly escaped parameters substituted.
pq\Result pq\Connection::execParamsAsync(string
$query, array
$params[, array
$types = NULL
, [callable
$cb = NULL
]])
Flush pending writes on the connection.
Fetch the result of an asynchronous query.
Listen on $channel for notifications.
void
pq\Connection::listen(string
$channel, callable
$listener)
Asynchronously start listening on $channel for notifcations.
void
pq\Connection::listenAsync(string
$channel, callable
$listener)
Notify all listeners on $channel with $message.
void
pq\Connection::notify(string
$channel, string
$message)
Asynchronously start notifying all listeners on $channel with $message.
void
pq\Connection::notifyAsync(string
$channel, string
$message)
Stops listening for an event type.
bool
pq\Connection::off(string
$event)
Listen for an event.
int
pq\Connection::on(string
$event, callable
$callback)
Poll an asynchronously operating connection.
Prepare a named statement for later execution with pq\Statement::execute().
pq\Statement pq\Connection::prepare(string
$name, string
$query[, array
$types = NULL
])
Asynchronously prepare a named statement for later execution with pq\Statement::exec().
pq\Statement pq\Connection::prepareAsync(string
$name, string
$query[, array
$types = NULL
])
Quote a string
for safe use in a query.
string
pq\Connection::quote(string
$payload)
Quote an identifier for safe usage as name.
string
pq\Connection::quoteName(string
$name)
Attempt to reset a possibly broken connection to a working state.
Asynchronously reset a possibly broken connection to a working state.
Set a data type converter.
void
pq\Connection::setConverter(pq\Converter $converter)
Begin a transaction.
pq\Transaction pq\Connection::startTransaction([int
$isolation = pq\Transaction::READ_COMMITTED[, bool
$readonly = FALSE
[, bool
$deferrable = FALSE
]]])
Asynchronously begin a transaction.
pq\Transaction pq\Connection::startTransactionAsync([int
$isolation = pq\Transaction::READ_COMMITTED[, bool
$readonly = FALSE
[, bool
$deferrable = FALSE
]]])
Trace protocol communication with the server.
bool
pq\Connection::trace([resource
$stream])
Unescape bytea data retrieved from the server.
string
pq\Connection::unescapeBytea(string
$bytea)
Stop listening for notifications on channel $channel.
void
pq\Connection::unlisten(string
$channel)
Asynchronously stop listening for notifications on channel $channel.
void
pq\Connection::unlistenAsync(string
$channel)
Stop applying a data type converter.
void
pq\Connection::unsetConverter(pq\Converter $converter)