(PHP 8 >= 8.4.0)
A PDO subclass representing a connection using the PostgreSQL PDO driver.
This driver supports a dedicated SQL query parser for the PostgreSQL dialect. It can handle the following:
Single and double-quoted literals, with doubling as escaping mechanism
C-style “escape” string literals
Dollar-quoted string literals
Two-dashes and C-style comments (non-nested).
Support for ?? as escape sequence for the
? operator.
Note:
Because this parser recognizes dollar-quoted string literals, question marks inside them are not treated as parameter placeholders and do not need to be escaped. As of PHP 8.4.0, escaping question marks as
??inside a dollar-quoted string is deprecated.
$tableName,$rows,$separator = "\t",$nullAs = "\\\\N",$fields = null$tableName,$filename,$separator = "\t",$nullAs = "\\\\N",$fields = null$tableName,$separator = "\t",$nullAs = "\\\\N",$fields = null$tableName,$filename,$separator = "\t",$nullAs = "\\\\N",$fields = null$fetchMode = PDO::FETCH_DEFAULT, int $timeoutMilliseconds = 0): array|false$dsn,$username = null,$password = null,$options = null$dsn,$username = null,$password = null,$options = null$query, ?int $fetchMode = PDO::FETCH_COLUMN, int $colno): PDOStatement|false$query,$fetchMode = PDO::FETCH_CLASS,$classname,$constructorArgs$query, ?int $fetchMode = PDO::FETCH_INTO, object $object): PDOStatement|falsePdo\Pgsql::ATTR_DISABLE_PREPARESSend the query and the parameters to the server together in a single call, avoiding the need to create a named prepared statement separately. If the query is only going to be executed once this can reduce latency by avoiding an unnecessary server round-trip.
Pdo\Pgsql::ATTR_RESULT_MEMORY_SIZE
Returns the amount of memory, in bytes, allocated to the specified
query result PDOStatement instance,
or null if no results exist before the query is executed.
PDO::ATTR_PREFETCH
As of PHP 8.5.0, setting this attribute to 0 enables
lazy (single-row) fetching: rows are retrieved from the server one at a
time as they are fetched, instead of buffering the whole result set in
memory before the first PDOStatement::fetch()
call. This reduces memory usage for large result sets. Any other value
keeps the default buffered behavior.
It can be set per connection with PDO::setAttribute(), or per statement via the PDO::prepare() driver options.
With lazy fetching, PDOStatement::rowCount() returns the number of rows most recently retrieved from the server, not the total.
In lazy mode, a connection can have only one active statement at a time. Running another statement silently discards any unread rows of the previous one; no error is raised.
Pdo\Pgsql::ATTR_CHUNK_SIZEThe maximum number of rows retrieved from the server at a time during lazy fetching. It allows balancing speed against memory usage.
A value from 1 to 2147483647
enables lazy fetching and takes precedence over
PDO::ATTR_PREFETCH.
With the default value of 0,
PDO::ATTR_PREFETCH determines how rows are fetched.
Other integers throw a ValueError.
Like PDO::ATTR_PREFETCH, it can be set per
connection or per statement.
Setting PDO::ATTR_PREFETCH on the connection or on
a statement overrides the connection's chunk size.
A statement with PDO::ATTR_CURSOR set to
PDO::CURSOR_SCROLL ignores the connection's chunk
size.
Setting this attribute to 1 or more on such a
statement throws a ValueError.
For the caveats of lazy fetching, see PDO::ATTR_PREFETCH.
Available as of PHP 8.6.0, when compiled against libpq >= 17.
Pdo\Pgsql::TRANSACTION_IDLEThis constant has no effect, and is deprecated as of PHP 8.5.0.
Pdo\Pgsql::TRANSACTION_ACTIVEThis constant has no effect, and is deprecated as of PHP 8.5.0.
Pdo\Pgsql::TRANSACTION_INTRANSThis constant has no effect, and is deprecated as of PHP 8.5.0.
Pdo\Pgsql::TRANSACTION_INERRORThis constant has no effect, and is deprecated as of PHP 8.5.0.
Pdo\Pgsql::TRANSACTION_UNKNOWNThis constant has no effect, and is deprecated as of PHP 8.5.0.