Convert resources to objects in ext/pgsql

Closes GH-6791

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
This commit is contained in:
Máté Kocsis 2021-05-11 00:09:30 +02:00
parent 57a635c655
commit 32aff25ceb
No known key found for this signature in database
GPG key ID: FD055E41728BF310
26 changed files with 1209 additions and 1253 deletions

5
NEWS
View file

@ -98,6 +98,11 @@ PHP NEWS
. PDO SQLite:
. Fixed bug #38334 (Proper data-type support for PDO_SQLITE). (Nikita)
- PgSQL:
. Convert resource<pgsql link> to object \PgSql\Connection. (Máté)
. Convert resource<pgsql result> to object \PgSql\Result. (Máté)
. Convert resource<pgsql large object> to object \PgSql\Lob. (Máté)
- PSpell:
. Convert resource<pspell> to object \PSpell\Dictionary. (Sara)
. Convert resource<pspell config> to object \PSpell\Config. (Sara)

View file

@ -120,6 +120,17 @@ PHP 8.1 UPGRADE NOTES
types. You can restore the previous behavior by enabling the
PDO::ATTR_STRINGIFY_FETCHES option.
- PgSQL:
. The PgSQL functions now accept and return, respectively, \PgSql\Connection
objects instead of "pgsql link" resources. Return value checks using
is_resource() should be replaced with checks for `false`.
. The PgSQL functions now accept and return, respectively, \PgSql\Result
objects instead of "pgsql result" resources. Return value checks using
is_resource() should be replaced with checks for `false`.
. The PgSQL functions now accept and return, respectively, \PgSql\Lob
objects instead of "pgsql large object" resources. Return value checks
using is_resource() should be replaced with checks for `false`.
- PSpell:
. The PSpell functions now accept and return, respectively, PSpell\Dictionary objects
instead of "pspell" resources. Return value checks using is_resource()

View file

@ -658,8 +658,6 @@ static const func_info_t func_infos[] = {
F1("session_encode", MAY_BE_FALSE | MAY_BE_STRING),
/* ext/pgsql */
FN("pg_connect", MAY_BE_FALSE | MAY_BE_RESOURCE),
FN("pg_pconnect", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_dbname", MAY_BE_STRING),
F1("pg_options", MAY_BE_STRING),
F1("pg_port", MAY_BE_STRING),
@ -667,10 +665,10 @@ static const func_info_t func_infos[] = {
F1("pg_host", MAY_BE_STRING),
F1("pg_version", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_STRING | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_NULL),
F1("pg_parameter_status", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_query", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_query_params", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_prepare", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_execute", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_query", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_query_params", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_prepare", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_execute", MAY_BE_FALSE | MAY_BE_OBJECT),
FN("pg_last_notice", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY ),
F1("pg_field_name", MAY_BE_STRING),
F1("pg_field_type_oid", MAY_BE_LONG | MAY_BE_STRING),
@ -683,7 +681,7 @@ static const func_info_t func_infos[] = {
F1("pg_fetch_all_columns", MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_NULL | MAY_BE_ARRAY_OF_STRING),
F1("pg_last_oid", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_lo_create", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_lo_open", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_lo_open", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_lo_read", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_lo_import", MAY_BE_FALSE | MAY_BE_LONG | MAY_BE_STRING),
F1("pg_copy_to", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING),
@ -694,13 +692,13 @@ static const func_info_t func_infos[] = {
F1("pg_escape_identifier", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_result_error", MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_result_error_field", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
F1("pg_get_result", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_get_result", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_result_status", MAY_BE_LONG | MAY_BE_STRING),
F1("pg_get_notify", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY),
F1("pg_socket", MAY_BE_FALSE | MAY_BE_RESOURCE),
F1("pg_socket", MAY_BE_FALSE | MAY_BE_OBJECT),
F1("pg_meta_data", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ARRAY),
F1("pg_convert", MAY_BE_FALSE | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_STRING | MAY_BE_ARRAY_OF_ANY),
F1("pg_insert", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_RESOURCE | MAY_BE_STRING),
F1("pg_insert", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_OBJECT | MAY_BE_STRING),
F1("pg_update", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("pg_delete", MAY_BE_FALSE | MAY_BE_TRUE | MAY_BE_STRING),
F1("pg_select", MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_ARRAY),

File diff suppressed because it is too large Load diff

View file

@ -2,267 +2,217 @@
/** @generate-class-entries */
/** @return resource|false */
function pg_connect(string $connection_string, int $flags = 0) {}
namespace PgSql {
/** @strict-properties */
final class Connection
{
}
/** @return resource|false */
function pg_pconnect(string $connection_string, int $flags = 0) {}
/** @strict-properties */
final class Result
{
}
/** @param resource $connection */
function pg_connect_poll($connection): int {}
/** @strict-properties */
final class Lob
{
}
}
/** @param resource|null $connection */
function pg_close($connection = null): bool {}
namespace {
function pg_connect(string $connection_string, int $flags = 0): PgSql\Connection|false {}
/** @param resource|null $connection */
function pg_dbname($connection = null): string {}
function pg_pconnect(string $connection_string, int $flags = 0): PgSql\Connection|false {}
/** @param resource|null $connection */
function pg_last_error($connection = null): string {}
function pg_connect_poll(PgSql\Connection $connection): int {}
function pg_close(?PgSql\Connection $connection = null): bool {}
function pg_dbname(?PgSql\Connection $connection = null): string {}
function pg_last_error(?PgSql\Connection $connection = null): string {}
/**
* @param resource|null $connection
* @alias pg_last_error
* @deprecated
*/
function pg_errormessage($connection = null): string {}
function pg_errormessage(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_options($connection = null): string {}
function pg_options(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_port($connection = null): string {}
function pg_port(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_tty($connection = null): string {}
function pg_tty(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_host($connection = null): string {}
function pg_host(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_version($connection = null): array {}
function pg_version(?PgSql\Connection $connection = null): array {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_parameter_status($connection, string $name = UNKNOWN): string|false {}
/** @param resource|null $connection */
function pg_ping($connection = null): bool {}
function pg_ping(?PgSql\Connection $connection = null): bool {}
/** @param PgSql\Connection|string $connection */
function pg_query($connection, string $query = UNKNOWN): PgSql\Result|false {}
/**
* @param resource|string $connection
* @return resource|false
*/
function pg_query($connection, string $query = UNKNOWN) {}
/**
* @param resource|string $connection
* @return resource|false
* @param PgSql\Connection|string $connection
* @alias pg_query
*/
function pg_exec($connection, string $query = UNKNOWN) {}
function pg_exec($connection, string $query = UNKNOWN): PgSql\Result|false {}
/**
* @param resource|string $connection
* @param PgSql\Connection|string $connection
* @param string|array $query
* @return resource|false
*/
function pg_query_params($connection, $query, array $params = UNKNOWN) {}
function pg_query_params($connection, $query, array $params = UNKNOWN): PgSql\Result|false {}
/** @param PgSql\Connection|string $connection */
function pg_prepare($connection, string $statement_name, string $query = UNKNOWN): PgSql\Result|false {}
/**
* @param resource|string $connection
* @return resource|false
*/
function pg_prepare($connection, string $statement_name, string $query = UNKNOWN) {}
/**
* @param resource|string $connection
* @param PgSql\Connection|string $connection
* @param string|array $statement_name
* @return resource|false
*/
function pg_execute($connection, $statement_name, array $params = UNKNOWN) {}
function pg_execute($connection, $statement_name, array $params = UNKNOWN): PgSql\Result|false {}
/** @param resource $result */
function pg_num_rows($result): int {}
function pg_num_rows(PgSql\Result $result): int {}
/**
* @param resource $result
* @alias pg_num_rows
* @deprecated
*/
function pg_numrows($result): int {}
function pg_numrows(PgSql\Result $result): int {}
/** @param resource $result */
function pg_num_fields($result): int {}
function pg_num_fields(PgSql\Result $result): int {}
/**
* @param resource $result
* @alias pg_num_fields
* @deprecated
*/
function pg_numfields($result): int {}
function pg_numfields(PgSql\Result $result): int {}
/** @param resource $result */
function pg_affected_rows($result): int {}
function pg_affected_rows(PgSql\Result $result): int {}
/**
* @param resource $result
* @alias pg_affected_rows
* @deprecated
*/
function pg_cmdtuples($result): int {}
function pg_cmdtuples(PgSql\Result $result): int {}
/** @param resource $connection */
function pg_last_notice($connection, int $mode = PGSQL_NOTICE_LAST): array|string|bool {}
function pg_last_notice(PgSql\Connection $connection, int $mode = PGSQL_NOTICE_LAST): array|string|bool {}
/** @param resource $result */
function pg_field_table($result, int $field, bool $oid_only = false): string|int|false {}
function pg_field_table(PgSql\Result $result, int $field, bool $oid_only = false): string|int|false {}
/** @param resource $result */
function pg_field_name($result, int $field): string {}
function pg_field_name(PgSql\Result $result, int $field): string {}
/**
* @param resource $result
* @alias pg_field_name
* @deprecated
*/
function pg_fieldname($result, int $field): string {}
function pg_fieldname(PgSql\Result $result, int $field): string {}
/** @param resource $result */
function pg_field_size($result, int $field): int {}
function pg_field_size(PgSql\Result $result, int $field): int {}
/**
* @param resource $result
* @alias pg_field_size
* @deprecated
*/
function pg_fieldsize($result, int $field): int {}
function pg_fieldsize(PgSql\Result $result, int $field): int {}
/** @param resource $result */
function pg_field_type($result, int $field): string {}
function pg_field_type(PgSql\Result $result, int $field): string {}
/**
* @param resource $result
* @alias pg_field_type
* @deprecated
*/
function pg_fieldtype($result, int $field): string {}
function pg_fieldtype(PgSql\Result $result, int $field): string {}
/** @param resource $result */
function pg_field_type_oid($result, int $field): string|int {}
function pg_field_type_oid(PgSql\Result $result, int $field): string|int {}
/** @param resource $result */
function pg_field_num($result, string $field): int {}
function pg_field_num(PgSql\Result $result, string $field): int {}
/**
* @param resource $result
* @alias pg_field_num
* @deprecated
*/
function pg_fieldnum($result, string $field): int {}
function pg_fieldnum(PgSql\Result $result, string $field): int {}
/** @param string|int $row */
function pg_fetch_result(PgSql\Result $result, $row, string|int $field = UNKNOWN): string|false|null {}
/**
* @param resource $result
* @param string|int $row
*/
function pg_fetch_result($result, $row, string|int $field = UNKNOWN): string|false|null {}
/**
* @param resource $result
* @param string|int $row
* @alias pg_fetch_result
* @deprecated
*/
function pg_result($result, $row, string|int $field = UNKNOWN): string|false|null {}
function pg_result(PgSql\Result $result, $row, string|int $field = UNKNOWN): string|false|null {}
function pg_fetch_row(PgSql\Result $result, ?int $row = null, int $mode = PGSQL_NUM): array|false {}
function pg_fetch_assoc(PgSql\Result $result, ?int $row = null): array|false {}
function pg_fetch_array(PgSql\Result $result, ?int $row = null, int $mode = PGSQL_BOTH): array|false {}
function pg_fetch_object(PgSql\Result $result, ?int $row = null, string $class = "stdClass", array $constructor_args = []): object|false {}
function pg_fetch_all(PgSql\Result $result, int $mode = PGSQL_ASSOC): array {}
function pg_fetch_all_columns(PgSql\Result $result, int $field = 0): array {}
function pg_result_seek(PgSql\Result $result, int $row): bool {}
/** @param string|int $row */
function pg_field_prtlen(PgSql\Result $result, $row, string|int $field = UNKNOWN): int|false {}
/**
* @param resource $result
*/
function pg_fetch_row($result, ?int $row = null, int $mode = PGSQL_NUM): array|false {}
/**
* @param resource $result
*/
function pg_fetch_assoc($result, ?int $row = null): array|false {}
/**
* @param resource $result
*/
function pg_fetch_array($result, ?int $row = null, int $mode = PGSQL_BOTH): array|false {}
/** @param resource $result */
function pg_fetch_object($result, ?int $row = null, string $class = "stdClass", array $constructor_args = []): object|false {}
/** @param resource $result */
function pg_fetch_all($result, int $mode = PGSQL_ASSOC): array {}
/** @param resource $result */
function pg_fetch_all_columns($result, int $field = 0): array {}
/** @param resource $result */
function pg_result_seek($result, int $row): bool {}
/**
* @param resource $result
* @param string|int $row
*/
function pg_field_prtlen($result, $row, string|int $field = UNKNOWN): int|false {}
/**
* @param resource $result
* @param string|int $row
* @alias pg_field_prtlen
* @deprecated
*/
function pg_fieldprtlen($result, $row, string|int $field = UNKNOWN): int|false {}
function pg_fieldprtlen(PgSql\Result $result, $row, string|int $field = UNKNOWN): int|false {}
/**
* @param resource $result
* @param string|int $row
*/
function pg_field_is_null($result, $row, string|int $field = UNKNOWN): int|false {}
function pg_field_is_null(PgSql\Result $result, $row, string|int $field = UNKNOWN): int|false {}
/**
* @param resource $result
* @param string|int $row
* @alias pg_field_is_null
* @deprecated
*/
function pg_fieldisnull($result, $row, string|int $field = UNKNOWN): int|false {}
function pg_fieldisnull(PgSql\Result $result, $row, string|int $field = UNKNOWN): int|false {}
/** @param resource $result */
function pg_free_result($result): bool {}
function pg_free_result(PgSql\Result $result): bool {}
/**
* @param resource $result
* @alias pg_free_result
* @deprecated
*/
function pg_freeresult($result): bool {}
function pg_freeresult(PgSql\Result $result): bool {}
/** @param resource $result */
function pg_last_oid($result): string|int|false {}
function pg_last_oid(PgSql\Result $result): string|int|false {}
/**
* @param resource $result
* @alias pg_last_oid
* @deprecated
*/
function pg_getlastoid($result): string|int|false {}
function pg_getlastoid(PgSql\Result $result): string|int|false {}
/** @param resource|null $connection */
function pg_trace(string $filename, string $mode = "w", $connection = null): bool {}
function pg_trace(string $filename, string $mode = "w", ?PgSql\Connection $connection = null): bool {}
/** @param resource|null $connection */
function pg_untrace($connection = null): bool {}
function pg_untrace(?PgSql\Connection $connection = null): bool {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
*/
function pg_lo_create($connection = UNKNOWN, $oid = UNKNOWN): string|int|false {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
* @alias pg_lo_create
* @deprecated
@ -270,13 +220,13 @@ function pg_lo_create($connection = UNKNOWN, $oid = UNKNOWN): string|int|false {
function pg_locreate($connection = UNKNOWN, $oid = UNKNOWN): string|int|false {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
*/
function pg_lo_unlink($connection, $oid = UNKNOWN): bool {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
* @alias pg_lo_unlink
* @deprecated
@ -284,232 +234,179 @@ function pg_lo_unlink($connection, $oid = UNKNOWN): bool {}
function pg_lounlink($connection, $oid = UNKNOWN): bool {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
* @return resource|false
*/
function pg_lo_open($connection, $oid = UNKNOWN, string $mode = UNKNOWN) {}
function pg_lo_open($connection, $oid = UNKNOWN, string $mode = UNKNOWN): PgSql\Lob|false {}
/**
* @param resource $connection
* @param PgSql\Connection $connection
* @param string|int $oid
* @return resource|false
* @alias pg_lo_open
* @deprecated
*/
function pg_loopen($connection, $oid = UNKNOWN, string $mode = UNKNOWN) {}
function pg_loopen($connection, $oid = UNKNOWN, string $mode = UNKNOWN): PgSql\Lob|false {}
/** @param resource $lob */
function pg_lo_close($lob): bool {}
function pg_lo_close(PgSql\Lob $lob): bool {}
/**
* @param resource $lob
* @alias pg_lo_close
* @deprecated
*/
function pg_loclose($lob): bool {}
function pg_loclose(PgSql\Lob $lob): bool {}
/** @param resource $lob */
function pg_lo_read($lob, int $length = 8192): string|false {}
function pg_lo_read(PgSql\Lob $lob, int $length = 8192): string|false {}
/**
* @param resource $lob
* @alias pg_lo_read
* @deprecated
*/
function pg_loread($lob, int $length = 8192): string|false {}
function pg_loread(PgSql\Lob $lob, int $length = 8192): string|false {}
/** @param resource $lob */
function pg_lo_write($lob, string $data, ?int $length = null): int|false {}
function pg_lo_write(PgSql\Lob $lob, string $data, ?int $length = null): int|false {}
/**
* @param resource $lob
* @alias pg_lo_write
* @deprecated
*/
function pg_lowrite($lob, string $data, ?int $length = null): int|false {}
function pg_lowrite(PgSql\Lob $lob, string $data, ?int $length = null): int|false {}
/** @param resource $lob */
function pg_lo_read_all($lob): int {}
function pg_lo_read_all(PgSql\Lob $lob): int {}
/**
* @param resource $lob
* @alias pg_lo_read_all
* @deprecated
*/
function pg_loreadall($lob): int {}
function pg_loreadall(PgSql\Lob $lob): int {}
/**
* @param resource|string $connection
* @param PgSql\Connection|string $connection
* @param string|int $filename
* @param string|int $oid
* @return resource|false
*/
function pg_lo_import($connection, $filename = UNKNOWN, $oid = UNKNOWN): string|int|false {}
/**
* @param resource|string $connection
* @param PgSql\Connection|string $connection
* @param string|int $filename
* @param string|int $oid
* @return resource|false
* @alias pg_lo_import
* @deprecated
*/
function pg_loimport($connection, $filename = UNKNOWN, $oid = UNKNOWN): string|int|false {}
/**
* @param resource|string|int $connection
* @param PgSql\Connection|string|int $connection
* @param string|int $oid
* @param string|int $filename
* @return resource|false
*/
function pg_lo_export($connection, $oid = UNKNOWN, $filename = UNKNOWN): bool {}
/**
* @param resource|string|int $connection
* @param PgSql\Connection|string|int $connection
* @param string|int $oid
* @param string|int $filename
* @return resource|false
* @alias pg_lo_export
* @deprecated
*/
function pg_loexport($connection, $oid = UNKNOWN, $filename = UNKNOWN): bool {}
/** @param resource $lob */
function pg_lo_seek($lob, int $offset, int $whence = SEEK_CUR): bool {}
function pg_lo_seek(PgSql\Lob $lob, int $offset, int $whence = SEEK_CUR): bool {}
/** @param resource $lob */
function pg_lo_tell($lob): int {}
function pg_lo_tell(PgSql\Lob $lob): int {}
/** @param resource $lob */
function pg_lo_truncate($lob, int $size): bool {}
function pg_lo_truncate(PgSql\Lob $lob, int $size): bool {}
/** @param resource|int $connection */
/** @param PgSql\Connection|int $connection */
function pg_set_error_verbosity($connection, int $verbosity = UNKNOWN): int|false {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_set_client_encoding($connection, string $encoding = UNKNOWN): int {}
/**
* @param resource|string $connection
* @param PgSql\Connection|string $connection
* @alias pg_set_client_encoding
* @deprecated
*/
function pg_setclientencoding($connection, string $encoding = UNKNOWN): int {}
/** @param resource|null $connection */
function pg_client_encoding($connection = null): string {}
function pg_client_encoding(?PgSql\Connection $connection = null): string {}
/**
* @param resource|null $connection
* @alias pg_client_encoding
* @deprecated
*/
function pg_clientencoding($connection = null): string {}
function pg_clientencoding(?PgSql\Connection $connection = null): string {}
/** @param resource|null $connection */
function pg_end_copy($connection = null): bool {}
function pg_end_copy(?PgSql\Connection $connection = null): bool {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_put_line($connection, string $query = UNKNOWN): bool {}
/** @param resource $connection */
function pg_copy_to($connection, string $table_name, string $separator = "\t", string $null_as = "\\\\N"): array|false {}
function pg_copy_to(PgSql\Connection $connection, string $table_name, string $separator = "\t", string $null_as = "\\\\N"): array|false {}
/** @param resource $connection */
function pg_copy_from($connection, string $table_name, array $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {}
function pg_copy_from(PgSql\Connection $connection, string $table_name, array $rows, string $separator = "\t", string $null_as = "\\\\N"): bool {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_escape_string($connection, string $string = UNKNOWN): string {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_escape_bytea($connection, string $string = UNKNOWN): string {}
function pg_unescape_bytea(string $string): string {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_escape_literal($connection, string $string = UNKNOWN): string|false {}
/** @param resource|string $connection */
/** @param PgSql\Connection|string $connection */
function pg_escape_identifier($connection, string $string = UNKNOWN): string|false {}
/** @param resource $result */
function pg_result_error($result): string|false {}
function pg_result_error(PgSql\Result $result): string|false {}
/** @param resource $result */
function pg_result_error_field($result, int $field_code): string|false|null {}
function pg_result_error_field(PgSql\Result $result, int $field_code): string|false|null {}
/** @param resource $connection */
function pg_connection_status($connection): int {}
function pg_connection_status(PgSql\Connection $connection): int {}
/** @param resource $connection */
function pg_transaction_status($connection): int {}
function pg_transaction_status(PgSql\Connection $connection): int {}
/** @param resource $connection */
function pg_connection_reset($connection): bool {}
function pg_connection_reset(PgSql\Connection $connection): bool {}
/** @param resource $connection */
function pg_cancel_query($connection): bool {}
function pg_cancel_query(PgSql\Connection $connection): bool {}
/** @param resource $connection */
function pg_connection_busy($connection): bool {}
function pg_connection_busy(PgSql\Connection $connection): bool {}
/** @param resource $connection */
function pg_send_query($connection, string $query): int|bool {}
function pg_send_query(PgSql\Connection $connection, string $query): int|bool {}
/** @param resource $connection */
function pg_send_query_params($connection, string $query, array $params): int|bool {}
function pg_send_query_params(PgSql\Connection $connection, string $query, array $params): int|bool {}
/** @param resource $connection */
function pg_send_prepare($connection, string $statement_name, string $query): int|bool {}
function pg_send_prepare(PgSql\Connection $connection, string $statement_name, string $query): int|bool {}
/** @param resource $connection */
function pg_send_execute($connection, string $query, array $params): int|bool {}
function pg_send_execute(PgSql\Connection $connection, string $query, array $params): int|bool {}
/**
* @param resource $connection
* @return resource|false
*/
function pg_get_result($connection) {}
function pg_get_result(PgSql\Connection $connection): PgSql\Result|false {}
/** @param resource $result */
function pg_result_status($result, int $mode = PGSQL_STATUS_LONG): string|int {}
function pg_result_status(PgSql\Result $result, int $mode = PGSQL_STATUS_LONG): string|int {}
/** @param resource $connection */
function pg_get_notify($connection, int $mode = PGSQL_ASSOC): array|false {}
function pg_get_notify(PgSql\Connection $connection, int $mode = PGSQL_ASSOC): array|false {}
/** @param resource $connection */
function pg_get_pid($connection): int {}
function pg_get_pid(PgSql\Connection $connection): int {}
/**
* @param resource $connection
* @return resource|false
*/
function pg_socket($connection) {}
/** @return resource|false */
function pg_socket(PgSql\Connection $connection) {}
/** @param resource $connection */
function pg_consume_input($connection): bool {}
function pg_consume_input(PgSql\Connection $connection): bool {}
/** @param resource $connection */
function pg_flush($connection): int|bool {}
function pg_flush(PgSql\Connection $connection): int|bool {}
/** @param resource $connection */
function pg_meta_data($connection, string $table_name, bool $extended = false): array|false {}
function pg_meta_data(PgSql\Connection $connection, string $table_name, bool $extended = false): array|false {}
/** @param resource $connection */
function pg_convert($connection, string $table_name, array $values, int $flags = 0): array|false {}
function pg_convert(PgSql\Connection $connection, string $table_name, array $values, int $flags = 0): array|false {}
/**
* @param resource $connection
* @return resource|string|bool
*/
function pg_insert($connection, string $table_name, array $values, int $flags = PGSQL_DML_EXEC) {}
function pg_insert(PgSql\Connection $connection, string $table_name, array $values, int $flags = PGSQL_DML_EXEC): PgSql\Result|string|bool {}
/** @param resource $connection */
function pg_update($connection, string $table_name, array $values, array $conditions, int $flags = PGSQL_DML_EXEC): string|bool {}
function pg_update(PgSql\Connection $connection, string $table_name, array $values, array $conditions, int $flags = PGSQL_DML_EXEC): string|bool {}
/** @param resource $connection */
function pg_delete($connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC): string|bool {}
function pg_delete(PgSql\Connection $connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC): string|bool {}
/** @param resource $connection */
function pg_select($connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC, int $mode = PGSQL_ASSOC): array|string|false {}
function pg_select(PgSql\Connection $connection, string $table_name, array $conditions, int $flags = PGSQL_DML_EXEC, int $mode = PGSQL_ASSOC): array|string|false {}
}

View file

@ -1,7 +1,7 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 949190bcdea7c4d889d0a7da190cf9aeb80ebaab */
* Stub hash: 1a3e16a1168698458b7de376533cb8e10e1725bd */
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connect, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_connect, 0, 1, PgSql\\Connection, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, connection_string, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
@ -9,15 +9,15 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_pconnect arginfo_pg_connect
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_connect_poll, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_close, 0, 0, _IS_BOOL, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection, "null")
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, connection, PgSql\\Connection, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_dbname, 0, 0, IS_STRING, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection, "null")
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, connection, PgSql\\Connection, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_pg_last_error arginfo_pg_dbname
@ -33,7 +33,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_host arginfo_pg_dbname
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_version, 0, 0, IS_ARRAY, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection, "null")
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, connection, PgSql\\Connection, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_parameter_status, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
@ -43,33 +43,33 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_ping arginfo_pg_close
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_query, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_query, 0, 1, PgSql\\Result, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_exec arginfo_pg_query
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_query_params, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_query_params, 0, 2, PgSql\\Result, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_INFO(0, query)
ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_prepare, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_prepare, 0, 2, PgSql\\Result, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_TYPE_INFO(0, statement_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_execute, 0, 0, 2)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_execute, 0, 2, PgSql\\Result, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_INFO(0, statement_name)
ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_num_rows, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_numrows arginfo_pg_num_rows
@ -83,25 +83,25 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_cmdtuples arginfo_pg_num_rows
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_last_notice, 0, 1, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_NOTICE_LAST")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_field_table, 0, 2, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, oid_only, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_field_name, 0, 2, IS_STRING, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_fieldname arginfo_pg_field_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_field_size, 0, 2, IS_LONG, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -112,19 +112,19 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_fieldtype arginfo_pg_field_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_field_type_oid, 0, 2, MAY_BE_STRING|MAY_BE_LONG)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_field_num, 0, 2, IS_LONG, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_fieldnum arginfo_pg_field_num
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_fetch_result, 0, 2, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_INFO(0, row)
ZEND_ARG_TYPE_MASK(0, field, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
@ -132,46 +132,46 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_result arginfo_pg_fetch_result
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_fetch_row, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, row, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_NUM")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_fetch_assoc, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, row, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_fetch_array, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, row, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_BOTH")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_fetch_object, 0, 1, MAY_BE_OBJECT|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, row, IS_LONG, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, class, IS_STRING, 0, "\"stdClass\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, constructor_args, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_fetch_all, 0, 1, IS_ARRAY, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_ASSOC")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_fetch_all_columns, 0, 1, IS_ARRAY, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, field, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_result_seek, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, row, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_field_prtlen, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_INFO(0, row)
ZEND_ARG_TYPE_MASK(0, field, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
@ -183,13 +183,13 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_fieldisnull arginfo_pg_field_prtlen
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_free_result, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_freeresult arginfo_pg_free_result
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_last_oid, 0, 1, MAY_BE_STRING|MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_getlastoid arginfo_pg_last_oid
@ -197,7 +197,7 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_trace, 0, 1, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_STRING, 0, "\"w\"")
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, connection, "null")
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, connection, PgSql\\Connection, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_pg_untrace arginfo_pg_close
@ -216,7 +216,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_lounlink arginfo_pg_lo_unlink
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_lo_open, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_lo_open, 0, 1, PgSql\\Lob, MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_INFO(0, oid)
ZEND_ARG_TYPE_INFO(0, mode, IS_STRING, 0)
@ -225,20 +225,20 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_loopen arginfo_pg_lo_open
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_lo_close, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_loclose arginfo_pg_lo_close
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_lo_read, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 0, "8192")
ZEND_END_ARG_INFO()
#define arginfo_pg_loread arginfo_pg_lo_read
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_lo_write, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, length, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
@ -246,7 +246,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_lowrite arginfo_pg_lo_write
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_lo_read_all, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_loreadall arginfo_pg_lo_read_all
@ -268,7 +268,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_loexport arginfo_pg_lo_export
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_lo_seek, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_ARG_TYPE_INFO(0, offset, IS_LONG, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, whence, IS_LONG, 0, "SEEK_CUR")
ZEND_END_ARG_INFO()
@ -276,7 +276,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_lo_tell arginfo_pg_lo_read_all
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_lo_truncate, 0, 2, _IS_BOOL, 0)
ZEND_ARG_INFO(0, lob)
ZEND_ARG_OBJ_INFO(0, lob, PgSql\\Lob, 0)
ZEND_ARG_TYPE_INFO(0, size, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -304,14 +304,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_put_line, 0, 1, _IS_BOOL, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_copy_to, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\"\\t\"")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, null_as, IS_STRING, 0, "\"\\\\\\\\N\"")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_copy_from, 0, 3, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, rows, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, separator, IS_STRING, 0, "\"\\t\"")
@ -337,11 +337,11 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_escape_identifier arginfo_pg_escape_literal
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_result_error, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_result_error_field, 0, 2, MAY_BE_STRING|MAY_BE_FALSE|MAY_BE_NULL)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field_code, IS_LONG, 0)
ZEND_END_ARG_INFO()
@ -350,7 +350,7 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_transaction_status arginfo_pg_connect_poll
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_pg_connection_reset, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_cancel_query arginfo_pg_connection_reset
@ -358,70 +358,72 @@ ZEND_END_ARG_INFO()
#define arginfo_pg_connection_busy arginfo_pg_connection_reset
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_send_query, 0, 2, MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_send_query_params, 0, 3, MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, params, IS_ARRAY, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_send_prepare, 0, 3, MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, statement_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_send_execute arginfo_pg_send_query_params
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_get_result, 0, 0, 1)
ZEND_ARG_INFO(0, connection)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_get_result, 0, 1, PgSql\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_result_status, 0, 1, MAY_BE_STRING|MAY_BE_LONG)
ZEND_ARG_INFO(0, result)
ZEND_ARG_OBJ_INFO(0, result, PgSql\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_STATUS_LONG")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_get_notify, 0, 1, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, mode, IS_LONG, 0, "PGSQL_ASSOC")
ZEND_END_ARG_INFO()
#define arginfo_pg_get_pid arginfo_pg_connect_poll
#define arginfo_pg_socket arginfo_pg_get_result
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_socket, 0, 0, 1)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_END_ARG_INFO()
#define arginfo_pg_consume_input arginfo_pg_connection_reset
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_flush, 0, 1, MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_meta_data, 0, 2, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, extended, _IS_BOOL, 0, "false")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_convert, 0, 3, MAY_BE_ARRAY|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_insert, 0, 0, 3)
ZEND_ARG_INFO(0, connection)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_pg_insert, 0, 3, PgSql\\Result, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "PGSQL_DML_EXEC")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_update, 0, 4, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, values, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO(0, conditions, IS_ARRAY, 0)
@ -429,14 +431,14 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_update, 0, 4, MAY_BE_STRING|M
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_delete, 0, 3, MAY_BE_STRING|MAY_BE_BOOL)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, conditions, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "PGSQL_DML_EXEC")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_pg_select, 0, 3, MAY_BE_ARRAY|MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, connection)
ZEND_ARG_OBJ_INFO(0, connection, PgSql\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, table_name, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, conditions, IS_ARRAY, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, flags, IS_LONG, 0, "PGSQL_DML_EXEC")
@ -652,3 +654,51 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE(pg_select, arginfo_pg_select)
ZEND_FE_END
};
static const zend_function_entry class_PgSql_Connection_methods[] = {
ZEND_FE_END
};
static const zend_function_entry class_PgSql_Result_methods[] = {
ZEND_FE_END
};
static const zend_function_entry class_PgSql_Lob_methods[] = {
ZEND_FE_END
};
static zend_class_entry *register_class_PgSql_Connection(void)
{
zend_class_entry ce, *class_entry;
INIT_NS_CLASS_ENTRY(ce, "PgSql", "Connection", class_PgSql_Connection_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
return class_entry;
}
static zend_class_entry *register_class_PgSql_Result(void)
{
zend_class_entry ce, *class_entry;
INIT_NS_CLASS_ENTRY(ce, "PgSql", "Result", class_PgSql_Result_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
return class_entry;
}
static zend_class_entry *register_class_PgSql_Lob(void)
{
zend_class_entry ce, *class_entry;
INIT_NS_CLASS_ENTRY(ce, "PgSql", "Lob", class_PgSql_Lob_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_FINAL|ZEND_ACC_NO_DYNAMIC_PROPERTIES;
return class_entry;
}

View file

@ -57,108 +57,6 @@ PHP_MSHUTDOWN_FUNCTION(pgsql);
PHP_RINIT_FUNCTION(pgsql);
PHP_RSHUTDOWN_FUNCTION(pgsql);
PHP_MINFO_FUNCTION(pgsql);
/* connection functions */
PHP_FUNCTION(pg_connect);
PHP_FUNCTION(pg_pconnect);
PHP_FUNCTION(pg_connect_poll);
PHP_FUNCTION(pg_close);
PHP_FUNCTION(pg_connection_reset);
PHP_FUNCTION(pg_connection_status);
PHP_FUNCTION(pg_connection_busy);
PHP_FUNCTION(pg_host);
PHP_FUNCTION(pg_dbname);
PHP_FUNCTION(pg_port);
PHP_FUNCTION(pg_tty);
PHP_FUNCTION(pg_options);
PHP_FUNCTION(pg_version);
PHP_FUNCTION(pg_ping);
PHP_FUNCTION(pg_parameter_status);
PHP_FUNCTION(pg_transaction_status);
/* query functions */
PHP_FUNCTION(pg_query);
PHP_FUNCTION(pg_query_params);
PHP_FUNCTION(pg_prepare);
PHP_FUNCTION(pg_execute);
PHP_FUNCTION(pg_send_query);
PHP_FUNCTION(pg_send_query_params);
PHP_FUNCTION(pg_send_prepare);
PHP_FUNCTION(pg_send_execute);
PHP_FUNCTION(pg_cancel_query);
/* result functions */
PHP_FUNCTION(pg_fetch_assoc);
PHP_FUNCTION(pg_fetch_array);
PHP_FUNCTION(pg_fetch_object);
PHP_FUNCTION(pg_fetch_result);
PHP_FUNCTION(pg_fetch_row);
PHP_FUNCTION(pg_fetch_all);
PHP_FUNCTION(pg_fetch_all_columns);
PHP_FUNCTION(pg_affected_rows);
PHP_FUNCTION(pg_get_result);
PHP_FUNCTION(pg_result_seek);
PHP_FUNCTION(pg_result_status);
PHP_FUNCTION(pg_free_result);
PHP_FUNCTION(pg_last_oid);
PHP_FUNCTION(pg_num_rows);
PHP_FUNCTION(pg_num_fields);
PHP_FUNCTION(pg_field_name);
PHP_FUNCTION(pg_field_num);
PHP_FUNCTION(pg_field_size);
PHP_FUNCTION(pg_field_type);
PHP_FUNCTION(pg_field_type_oid);
PHP_FUNCTION(pg_field_prtlen);
PHP_FUNCTION(pg_field_is_null);
PHP_FUNCTION(pg_field_table);
/* async message functions */
PHP_FUNCTION(pg_get_notify);
PHP_FUNCTION(pg_socket);
PHP_FUNCTION(pg_consume_input);
PHP_FUNCTION(pg_flush);
PHP_FUNCTION(pg_get_pid);
/* error message functions */
PHP_FUNCTION(pg_result_error);
PHP_FUNCTION(pg_result_error_field);
PHP_FUNCTION(pg_last_error);
PHP_FUNCTION(pg_last_notice);
/* copy functions */
PHP_FUNCTION(pg_put_line);
PHP_FUNCTION(pg_end_copy);
PHP_FUNCTION(pg_copy_to);
PHP_FUNCTION(pg_copy_from);
/* large object functions */
PHP_FUNCTION(pg_lo_create);
PHP_FUNCTION(pg_lo_unlink);
PHP_FUNCTION(pg_lo_open);
PHP_FUNCTION(pg_lo_close);
PHP_FUNCTION(pg_lo_read);
PHP_FUNCTION(pg_lo_write);
PHP_FUNCTION(pg_lo_read_all);
PHP_FUNCTION(pg_lo_import);
PHP_FUNCTION(pg_lo_export);
PHP_FUNCTION(pg_lo_seek);
PHP_FUNCTION(pg_lo_tell);
PHP_FUNCTION(pg_lo_truncate);
/* debugging functions */
PHP_FUNCTION(pg_trace);
PHP_FUNCTION(pg_untrace);
/* utility functions */
PHP_FUNCTION(pg_client_encoding);
PHP_FUNCTION(pg_set_client_encoding);
PHP_FUNCTION(pg_set_error_verbosity);
PHP_FUNCTION(pg_escape_string);
PHP_FUNCTION(pg_escape_bytea);
PHP_FUNCTION(pg_unescape_bytea);
PHP_FUNCTION(pg_escape_literal);
PHP_FUNCTION(pg_escape_identifier);
/* misc functions */
PHP_FUNCTION(pg_meta_data);
PHP_FUNCTION(pg_convert);
PHP_FUNCTION(pg_insert);
PHP_FUNCTION(pg_update);
PHP_FUNCTION(pg_delete);
PHP_FUNCTION(pg_select);
/* connection options - ToDo: Add async connection option */
#define PGSQL_CONNECT_FORCE_NEW (1<<1)
@ -245,15 +143,25 @@ typedef enum _php_pgsql_data_type {
PG_UNKNOWN
} php_pgsql_data_type;
typedef struct pgsql_link_handle {
PGconn *conn;
zend_string *hash;
HashTable *notices;
bool persistent;
zend_object std;
} pgsql_link_handle;
typedef struct pgLofp {
PGconn *conn;
int lofd;
zend_object std;
} pgLofp;
typedef struct _php_pgsql_result_handle {
PGconn *conn;
PGresult *result;
int row;
zend_object std;
} pgsql_result_handle;
typedef struct _php_pgsql_notice {
@ -278,13 +186,11 @@ ZEND_BEGIN_MODULE_GLOBALS(pgsql)
zend_long max_links,max_persistent;
zend_long allow_persistent;
zend_long auto_reset_persistent;
int le_lofp,le_string;
int ignore_notices,log_notices;
HashTable notices; /* notice message for each connection */
zend_resource *default_link; /* default link when connection is omitted */
HashTable hashes; /* hashes for each connection */
zend_object *default_link; /* default link when connection is omitted */
HashTable field_oids;
HashTable table_oids;
HashTable connections;
ZEND_END_MODULE_GLOBALS(pgsql)
ZEND_EXTERN_MODULE_GLOBALS(pgsql)

View file

@ -11,7 +11,6 @@ include('config.inc');
$db = pg_connect($conn_str);
var_dump(pg_version($db));
pg_close($db);
// Get environment vars for debugging
var_dump(serialize($_ENV));

View file

@ -54,4 +54,5 @@ pg_close($db);
?>
--EXPECTF--
resource(%d) of type (pgsql link%s)
object(PgSql\Connection)#%d (0) {
}

View file

@ -49,7 +49,8 @@ try {
}
?>
--EXPECTF--
resource(%d) of type (pgsql result)
object(PgSql\Result)#%d (0) {
}
string(0) ""
array(0) {
}

View file

@ -60,4 +60,4 @@ Array of values must be an associative array with string keys
Array of values must be an associative array with string keys
Values must be of type string|int|float|bool|null, array given
Values must be of type string|int|float|bool|null, stdClass given
Values must be of type string|int|float|bool|null, resource given
Values must be of type string|int|float|bool|null, PgSql\Connection given

View file

@ -19,7 +19,7 @@ $fields = array('num'=>'1234', 'str'=>'AAA', 'bin'=>'BBB');
pg_insert($db, $table_name, $fields) or print "Error in test 1\n";
echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING)."\n";
echo pg_insert($db, $table_name, $fields, PGSQL_DML_STRING|PGSQL_DML_ESCAPE)."\n";
var_dump( pg_insert($db, $table_name, $fields, PGSQL_DML_EXEC) ); // Return resource
var_dump( pg_insert($db, $table_name, $fields, PGSQL_DML_EXEC) );
/* Invalid values */
try {
@ -54,10 +54,11 @@ echo "Ok\n";
--EXPECTF--
INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES (1234,E'AAA',E'\\x424242');
INSERT INTO "php_pgsql_test" ("num","str","bin") VALUES ('1234','AAA','BBB');
resource(%d) of type (pgsql result)
object(PgSql\Result)#%d (0) {
}
Array of values must be an associative array with string keys
Array of values must be an associative array with string keys
Values must be of type string|int|float|bool|null, array given
Values must be of type string|int|float|bool|null, stdClass given
Values must be of type string|int|float|bool|null, resource given
Values must be of type string|int|float|bool|null, PgSql\Connection given
Ok

View file

@ -80,5 +80,5 @@ Array of values must be an associative array with string keys
Array of values must be an associative array with string keys
Values must be of type string|int|float|bool|null, array given
Values must be of type string|int|float|bool|null, stdClass given
Values must be of type string|int|float|bool|null, resource given
Values must be of type string|int|float|bool|null, PgSql\Connection given
Ok

View file

@ -23,9 +23,9 @@ var_dump(pg_result_seek($result, 0));
echo "Ok\n";
?>
--EXPECT--
--EXPECTF--
bool(true)
object(stdClass)#1 (3) {
object(stdClass)#%d (3) {
["num"]=>
string(1) "1"
["str"]=>

View file

@ -30,9 +30,9 @@ try {
echo "Ok\n";
?>
--EXPECT--
--EXPECTF--
test_class::__construct(1,2)
object(test_class)#1 (3) {
object(test_class)#%d (3) {
["num"]=>
string(1) "0"
["str"]=>

View file

@ -93,5 +93,5 @@ Invalid OID value passed
OID value must be of type string|int, bool given
OID value must be of type string|int, array given
OID value must be of type string|int, stdClass given
OID value must be of type string|int, resource given
OID value must be of type string|int, PgSql\Connection given
OK

View file

@ -53,8 +53,10 @@ pg_close($dbh);
?>
--EXPECTF--
resource(%d) of type (pgsql result)
resource(%d) of type (pgsql result)
object(PgSql\Result)#%d (0) {
}
object(PgSql\Result)#%d (0) {
}
array(1) {
[0]=>
string(1) "f"

View file

@ -23,40 +23,41 @@ pgsql.ignore_notice=0
require_once('config.inc');
require_once('lcmess.inc');
define('dbh', pg_connect($conn_str));
if (!dbh) {
$dbh = pg_connect($conn_str);
if (!$dbh) {
die ("Could not connect to the server");
}
_set_lc_messages();
$res = pg_query(dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
begin
RAISE NOTICE ''11111'';
return ''f'';
end;
' LANGUAGE plpgsql;");
$res = pg_query(dbh, 'SET client_min_messages TO NOTICE;');
$res = pg_query($dbh, 'SET client_min_messages TO NOTICE;');
var_dump($res);
function tester() {
$res = pg_query(dbh, 'SELECT test_notice()');
function tester($dbh) {
$res = pg_query($dbh, 'SELECT test_notice()');
$row = pg_fetch_row($res, 0);
var_dump($row);
pg_free_result($res);
if ($row[0] == 'f')
{
var_dump(pg_last_notice(dbh));
var_dump(pg_last_notice($dbh));
}
}
tester();
tester($dbh);
pg_close(dbh);
pg_close($dbh);
?>
--EXPECTF--
resource(%d) of type (pgsql result)
object(PgSql\Result)#%d (0) {
}
array(1) {
[0]=>
string(1) "f"

View file

@ -50,6 +50,7 @@ unlink($tracefile);
?>
--EXPECTF--
bool(false)
resource(%d) of type (pgsql result)
object(PgSql\Result)#%d (0) {
}
bool(true)
bool(true)

View file

@ -3,8 +3,8 @@ Bug #46408 (Locale number format settings can cause pg_query_params to break wit
--SKIPIF--
<?php
require_once('skipif.inc');
if (false === setlocale(LC_ALL, 'de_DE.utf-8', 'de_DE')) {
echo "skip Locale de_DE.utf-8 not present";
if (false === setlocale(LC_ALL, "de", "de_DE", "de_DE.ISO8859-1", "de_DE.ISO_8859-1", "de_DE.UTF-8")) {
echo "skip Locale de-DE not present";
}
?>
--FILE--
@ -13,7 +13,7 @@ if (false === setlocale(LC_ALL, 'de_DE.utf-8', 'de_DE')) {
require_once('config.inc');
$dbh = pg_connect($conn_str);
setlocale(LC_ALL, 'de_DE.utf-8', 'de_DE');
setlocale(LC_ALL, "de", "de_DE", "de_DE.ISO8859-1", "de_DE.ISO_8859-1", "de_DE.UTF-8");
echo 3.5 , "\n";
pg_query_params("SELECT $1::numeric", array(3.5));
pg_close($dbh);

View file

@ -41,7 +41,7 @@ var_dump(pg_fetch_row($result, 0));
pg_close($db);
?>
--EXPECT--
--EXPECTF--
pg_fetch_array(): Argument #2 ($row) must be greater than or equal to 0
pg_fetch_assoc(): Argument #2 ($row) must be greater than or equal to 0
pg_fetch_object(): Argument #2 ($row) must be greater than or equal to 0
@ -56,7 +56,7 @@ array(1) {
["?column?"]=>
string(1) "a"
}
object(stdClass)#1 (1) {
object(stdClass)#%d (1) {
["?column?"]=>
string(1) "a"
}

View file

@ -31,6 +31,6 @@ pg_query($conn, "ROLLBACK");
pg_close($conn);
?>
--EXPECTF--
pg_lo_create(): supplied resource is not a valid PostgreSQL link resource%w
pg_lo_create(): Argument #1 ($connection) must be of type PgSql\Connection when the connection is provided%w
int(%d)
int(%d)

View file

@ -10,6 +10,7 @@ include('config.inc');
$db1 = pg_connect($conn_str);
unset($db1);
var_dump(pg_close());
$db2 = pg_connect($conn_str);
unset($db2);
var_dump(pg_close());

View file

@ -0,0 +1,17 @@
--TEST--
Reusing connection with same connection string
--SKIPIF--
<?php include("skipif.inc"); ?>
--FILE--
<?php
include('config.inc');
$db1 = pg_connect($conn_str);
$db2 = pg_connect($conn_str);
var_dump($db1, $db2);
?>
--EXPECT--
object(PgSql\Connection)#1 (0) {
}
object(PgSql\Connection)#1 (0) {
}

View file

@ -11,4 +11,4 @@ try {
?>
--EXPECT--
No PostgreSQL link opened yet
No PostgreSQL connection opened yet

View file

@ -18,7 +18,7 @@ if (getenv("SKIP_REPEAT")) {
die("skip Cannot repeat pgsql tests");
}
$conn = @pg_connect($conn_str);
if (!is_resource($conn)) {
if (!$conn) {
die("skip could not connect\n");
}