Statement
class Statement (View source)
A named prepared statement.
See pq\Connection::prepare().
Properties
Connection read-only | $connection | The connection to the server. |
|
string read-only | $name | The identifiying name of the prepared statement. |
|
string read-only | $query | The query string used to prepare the statement. |
|
array read-only | $types | List of corresponding query parameter type OIDs for the prepared statement. |
Methods
Prepare a new statement.
Bind a variable to an input parameter.
Free the server resources used by the prepared statement, so it can no longer be executed.
[Asynchronously](pq/Connection/: Asynchronous Usage) free the server resources used by the prepared statement, so it can no longer be executed.
Describe the parameters of the prepared statement.
[Asynchronously](pq/Connection/: Asynchronous Usage) describe the parameters of the prepared statement.
[Asynchronously](pq/Connection/: Asynchronous Usage) execute the prepared statement.
Re-prepare a statement that has been deallocated. This is a no-op on already open statements.
[Asynchronously](pq/Connection/: Asynchronous Usage) re-prepare a statement that has been deallocated. This is a no-op on already open statements.
Details
__construct(Connection $conn, string $name, string $query, array $types = null, bool $async = false)
Prepare a new statement.
See pq\Connection::prepare().
bind(int $param_no, mixed $param_ref)
Bind a variable to an input parameter.
deallocate()
Free the server resources used by the prepared statement, so it can no longer be executed.
This is done implicitly when the object is destroyed.
deallocateAsync()
[Asynchronously](pq/Connection/: Asynchronous Usage) free the server resources used by the prepared statement, so it can no longer be executed.
array
desc()
Describe the parameters of the prepared statement.
descAsync(callable $callback)
[Asynchronously](pq/Connection/: Asynchronous Usage) describe the parameters of the prepared statement.
Result
exec(array $params = null)
Execute the prepared statement.
execAsync(array $params = null, callable $cb = null)
[Asynchronously](pq/Connection/: Asynchronous Usage) execute the prepared statement.
prepare()
Re-prepare a statement that has been deallocated. This is a no-op on already open statements.
prepareAsync()
[Asynchronously](pq/Connection/: Asynchronous Usage) re-prepare a statement that has been deallocated. This is a no-op on already open statements.