1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Migrate ext/odbc resources to opaque objects (#12040)

Co-authored-by: Niels Dossche <7771979+nielsdos@users.noreply.github.com>
This commit is contained in:
Máté Kocsis
2024-04-28 15:45:56 +02:00
committed by GitHub
parent 57cd23d6d0
commit afd91fb9ac
15 changed files with 1302 additions and 999 deletions

View File

@@ -68,6 +68,12 @@ PHP 8.4 UPGRADE NOTES
- ODBC:
. odbc_fetch_row() returns false when a value less than or equal to 0 is
passed for parameter $row. Now, a warning is emitted in this case.
. odbc_connect() and odbc_pconnect() will now return an Odbc\Connection
object rather than a resource. Return value checks using is_resource()
should be replaced with checks for `false`.
. odbc_prepare(), odbc_exec(), and various other functions will now return
an Odbc\Result object rather than a resource. Return value checks using
is_resource() should be replaced with checks for `false`.
- Opcache:
. The JIT config defaults changed from opcache.jit=tracing and

View File

@@ -308,31 +308,6 @@ static const func_info_t func_infos[] = {
F1("mysqli_stat", MAY_BE_STRING|MAY_BE_FALSE),
F1("mysqli_store_result", MAY_BE_OBJECT|MAY_BE_FALSE),
F1("mysqli_use_result", MAY_BE_OBJECT|MAY_BE_FALSE),
FN("odbc_prepare", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_exec", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_connect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_pconnect", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_tables", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_columns", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_gettypeinfo", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_primarykeys", MAY_BE_RESOURCE|MAY_BE_FALSE),
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_procedurecolumns", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_procedures", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
FN("odbc_foreignkeys", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
FN("odbc_specialcolumns", MAY_BE_RESOURCE|MAY_BE_FALSE),
FN("odbc_statistics", MAY_BE_RESOURCE|MAY_BE_FALSE),
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
FN("odbc_tableprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
FN("odbc_columnprivileges", MAY_BE_RESOURCE|MAY_BE_FALSE),
#endif
F1("opcache_get_status", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("opcache_get_configuration", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_ANY|MAY_BE_FALSE),
F1("openssl_x509_parse", MAY_BE_ARRAY|MAY_BE_ARRAY_KEY_STRING|MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_STRING|MAY_BE_ARRAY_OF_ARRAY|MAY_BE_FALSE),

View File

@@ -2,520 +2,447 @@
/** @generate-class-entries */
/**
* @var string
* @cvalue PHP_ODBC_TYPE
*/
const ODBC_TYPE = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_PASSTHRU
*/
const ODBC_BINMODE_PASSTHRU = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_RETURN
*/
const ODBC_BINMODE_RETURN = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_CONVERT
*/
const ODBC_BINMODE_CONVERT = UNKNOWN;
namespace Odbc {
/**
* @strict-properties
* @not-serializable
*/
class Connection
{
}
/* Define Constants for options. These Constants are defined in <sqlext.h> */
/**
* @strict-properties
* @not-serializable
*/
class Result
{
}
}
/**
* @var int
* @cvalue SQL_ODBC_CURSORS
*/
const SQL_ODBC_CURSORS = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_DRIVER
*/
const SQL_CUR_USE_DRIVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_IF_NEEDED
*/
const SQL_CUR_USE_IF_NEEDED = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_ODBC
*/
const SQL_CUR_USE_ODBC = UNKNOWN;
namespace {
/**
* @var string
* @cvalue PHP_ODBC_TYPE
*/
const ODBC_TYPE = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_PASSTHRU
*/
const ODBC_BINMODE_PASSTHRU = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_RETURN
*/
const ODBC_BINMODE_RETURN = UNKNOWN;
/**
* @var int
* @cvalue PHP_ODBC_BINMODE_CONVERT
*/
const ODBC_BINMODE_CONVERT = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCURRENCY
*/
const SQL_CONCURRENCY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_READ_ONLY
*/
const SQL_CONCUR_READ_ONLY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_LOCK
*/
const SQL_CONCUR_LOCK = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_ROWVER
*/
const SQL_CONCUR_ROWVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_VALUES
*/
const SQL_CONCUR_VALUES = UNKNOWN;
/* Define Constants for options. These Constants are defined in <sqlext.h> */
/**
* @var int
* @cvalue SQL_CURSOR_TYPE
*/
const SQL_CURSOR_TYPE = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_FORWARD_ONLY
*/
const SQL_CURSOR_FORWARD_ONLY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_KEYSET_DRIVEN
*/
const SQL_CURSOR_KEYSET_DRIVEN = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_DYNAMIC
*/
const SQL_CURSOR_DYNAMIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_STATIC
*/
const SQL_CURSOR_STATIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_ODBC_CURSORS
*/
const SQL_ODBC_CURSORS = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_DRIVER
*/
const SQL_CUR_USE_DRIVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_IF_NEEDED
*/
const SQL_CUR_USE_IF_NEEDED = UNKNOWN;
/**
* @var int
* @cvalue SQL_CUR_USE_ODBC
*/
const SQL_CUR_USE_ODBC = UNKNOWN;
/**
* @var int
* @cvalue SQL_KEYSET_SIZE
*/
const SQL_KEYSET_SIZE = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCURRENCY
*/
const SQL_CONCURRENCY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_READ_ONLY
*/
const SQL_CONCUR_READ_ONLY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_LOCK
*/
const SQL_CONCUR_LOCK = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_ROWVER
*/
const SQL_CONCUR_ROWVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_CONCUR_VALUES
*/
const SQL_CONCUR_VALUES = UNKNOWN;
/* these are for the Data Source type */
/**
* @var int
* @cvalue SQL_CURSOR_TYPE
*/
const SQL_CURSOR_TYPE = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_FORWARD_ONLY
*/
const SQL_CURSOR_FORWARD_ONLY = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_KEYSET_DRIVEN
*/
const SQL_CURSOR_KEYSET_DRIVEN = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_DYNAMIC
*/
const SQL_CURSOR_DYNAMIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_CURSOR_STATIC
*/
const SQL_CURSOR_STATIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_FETCH_FIRST
*/
const SQL_FETCH_FIRST = UNKNOWN;
/**
* @var int
* @cvalue SQL_FETCH_NEXT
*/
const SQL_FETCH_NEXT = UNKNOWN;
/**
* @var int
* @cvalue SQL_KEYSET_SIZE
*/
const SQL_KEYSET_SIZE = UNKNOWN;
/* register the standard data types */
/* these are for the Data Source type */
/**
* @var int
* @cvalue SQL_CHAR
*/
const SQL_CHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_VARCHAR
*/
const SQL_VARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_LONGVARCHAR
*/
const SQL_LONGVARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_DECIMAL
*/
const SQL_DECIMAL = UNKNOWN;
/**
* @var int
* @cvalue SQL_NUMERIC
*/
const SQL_NUMERIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_BIT
*/
const SQL_BIT = UNKNOWN;
/**
* @var int
* @cvalue SQL_TINYINT
*/
const SQL_TINYINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_SMALLINT
*/
const SQL_SMALLINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_INTEGER
*/
const SQL_INTEGER = UNKNOWN;
/**
* @var int
* @cvalue SQL_BIGINT
*/
const SQL_BIGINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_REAL
*/
const SQL_REAL = UNKNOWN;
/**
* @var int
* @cvalue SQL_FLOAT
*/
const SQL_FLOAT = UNKNOWN;
/**
* @var int
* @cvalue SQL_DOUBLE
*/
const SQL_DOUBLE = UNKNOWN;
/**
* @var int
* @cvalue SQL_BINARY
*/
const SQL_BINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_VARBINARY
*/
const SQL_VARBINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_LONGVARBINARY
*/
const SQL_LONGVARBINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_DATE
*/
const SQL_DATE = UNKNOWN;
/**
* @var int
* @cvalue SQL_TIME
*/
const SQL_TIME = UNKNOWN;
/**
* @var int
* @cvalue SQL_TIMESTAMP
*/
const SQL_TIMESTAMP = UNKNOWN;
/**
* @var int
* @cvalue SQL_FETCH_FIRST
*/
const SQL_FETCH_FIRST = UNKNOWN;
/**
* @var int
* @cvalue SQL_FETCH_NEXT
*/
const SQL_FETCH_NEXT = UNKNOWN;
/* register the standard data types */
/**
* @var int
* @cvalue SQL_CHAR
*/
const SQL_CHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_VARCHAR
*/
const SQL_VARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_LONGVARCHAR
*/
const SQL_LONGVARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_DECIMAL
*/
const SQL_DECIMAL = UNKNOWN;
/**
* @var int
* @cvalue SQL_NUMERIC
*/
const SQL_NUMERIC = UNKNOWN;
/**
* @var int
* @cvalue SQL_BIT
*/
const SQL_BIT = UNKNOWN;
/**
* @var int
* @cvalue SQL_TINYINT
*/
const SQL_TINYINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_SMALLINT
*/
const SQL_SMALLINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_INTEGER
*/
const SQL_INTEGER = UNKNOWN;
/**
* @var int
* @cvalue SQL_BIGINT
*/
const SQL_BIGINT = UNKNOWN;
/**
* @var int
* @cvalue SQL_REAL
*/
const SQL_REAL = UNKNOWN;
/**
* @var int
* @cvalue SQL_FLOAT
*/
const SQL_FLOAT = UNKNOWN;
/**
* @var int
* @cvalue SQL_DOUBLE
*/
const SQL_DOUBLE = UNKNOWN;
/**
* @var int
* @cvalue SQL_BINARY
*/
const SQL_BINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_VARBINARY
*/
const SQL_VARBINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_LONGVARBINARY
*/
const SQL_LONGVARBINARY = UNKNOWN;
/**
* @var int
* @cvalue SQL_DATE
*/
const SQL_DATE = UNKNOWN;
/**
* @var int
* @cvalue SQL_TIME
*/
const SQL_TIME = UNKNOWN;
/**
* @var int
* @cvalue SQL_TIMESTAMP
*/
const SQL_TIMESTAMP = UNKNOWN;
#if (defined(ODBCVER) && (ODBCVER >= 0x0300))
/**
* @var int
* @cvalue SQL_TYPE_DATE
*/
const SQL_TYPE_DATE = UNKNOWN;
/**
* @var int
* @cvalue SQL_TYPE_TIME
*/
const SQL_TYPE_TIME = UNKNOWN;
/**
* @var int
* @cvalue SQL_TYPE_TIMESTAMP
*/
const SQL_TYPE_TIMESTAMP = UNKNOWN;
/**
* @var int
* @cvalue SQL_WCHAR
*/
const SQL_WCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_WVARCHAR
*/
const SQL_WVARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_WLONGVARCHAR
*/
const SQL_WLONGVARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_TYPE_DATE
*/
const SQL_TYPE_DATE = UNKNOWN;
/**
* @var int
* @cvalue SQL_TYPE_TIME
*/
const SQL_TYPE_TIME = UNKNOWN;
/**
* @var int
* @cvalue SQL_TYPE_TIMESTAMP
*/
const SQL_TYPE_TIMESTAMP = UNKNOWN;
/**
* @var int
* @cvalue SQL_WCHAR
*/
const SQL_WCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_WVARCHAR
*/
const SQL_WVARCHAR = UNKNOWN;
/**
* @var int
* @cvalue SQL_WLONGVARCHAR
*/
const SQL_WLONGVARCHAR = UNKNOWN;
/* SQLSpecialColumns values */
/* SQLSpecialColumns values */
/**
* @var int
* @cvalue SQL_BEST_ROWID
*/
const SQL_BEST_ROWID = UNKNOWN;
/**
* @var int
* @cvalue SQL_ROWVER
*/
const SQL_ROWVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_CURROW
*/
const SQL_SCOPE_CURROW = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_TRANSACTION
*/
const SQL_SCOPE_TRANSACTION = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_SESSION
*/
const SQL_SCOPE_SESSION = UNKNOWN;
/**
* @var int
* @cvalue SQL_NO_NULLS
*/
const SQL_NO_NULLS = UNKNOWN;
/**
* @var int
* @cvalue SQL_NULLABLE
*/
const SQL_NULLABLE = UNKNOWN;
/**
* @var int
* @cvalue SQL_BEST_ROWID
*/
const SQL_BEST_ROWID = UNKNOWN;
/**
* @var int
* @cvalue SQL_ROWVER
*/
const SQL_ROWVER = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_CURROW
*/
const SQL_SCOPE_CURROW = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_TRANSACTION
*/
const SQL_SCOPE_TRANSACTION = UNKNOWN;
/**
* @var int
* @cvalue SQL_SCOPE_SESSION
*/
const SQL_SCOPE_SESSION = UNKNOWN;
/**
* @var int
* @cvalue SQL_NO_NULLS
*/
const SQL_NO_NULLS = UNKNOWN;
/**
* @var int
* @cvalue SQL_NULLABLE
*/
const SQL_NULLABLE = UNKNOWN;
/* SQLStatistics values */
/* SQLStatistics values */
/**
* @var int
* @cvalue SQL_INDEX_UNIQUE
*/
const SQL_INDEX_UNIQUE = UNKNOWN;
/**
* @var int
* @cvalue SQL_INDEX_ALL
*/
const SQL_INDEX_ALL = UNKNOWN;
/**
* @var int
* @cvalue SQL_ENSURE
*/
const SQL_ENSURE = UNKNOWN;
/**
* @var int
* @cvalue SQL_QUICK
*/
const SQL_QUICK = UNKNOWN;
/**
* @var int
* @cvalue SQL_INDEX_UNIQUE
*/
const SQL_INDEX_UNIQUE = UNKNOWN;
/**
* @var int
* @cvalue SQL_INDEX_ALL
*/
const SQL_INDEX_ALL = UNKNOWN;
/**
* @var int
* @cvalue SQL_ENSURE
*/
const SQL_ENSURE = UNKNOWN;
/**
* @var int
* @cvalue SQL_QUICK
*/
const SQL_QUICK = UNKNOWN;
#endif
function odbc_close_all(): void {}
function odbc_binmode(Odbc\Result $statement, int $mode): true {}
function odbc_close_all(): void {}
function odbc_longreadlen(Odbc\Result $statement, int $length): true {}
/** @param resource $statement */
function odbc_binmode($statement, int $mode): true {}
function odbc_prepare(Odbc\Connection $odbc, string $query): Odbc\Result|false {}
/** @param resource $statement */
function odbc_longreadlen($statement, int $length): true {}
function odbc_execute(Odbc\Result $statement, array $params = []): bool {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_prepare($odbc, string $query) {}
/** @param resource $statement */
function odbc_execute($statement, array $params = []): bool {}
/** @param resource $statement */
function odbc_cursor($statement): string|false {}
function odbc_cursor(Odbc\Result $statement): string|false {}
#ifdef HAVE_SQLDATASOURCES
/** @param resource $odbc */
function odbc_data_source($odbc, int $fetch_type): array|null|false {}
function odbc_data_source(Odbc\Connection $odbc, int $fetch_type): array|null|false {}
#endif
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_exec($odbc, string $query) {}
function odbc_exec(Odbc\Connection $odbc, string $query): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
* @alias odbc_exec
*/
function odbc_do($odbc, string $query) {}
/** @alias odbc_exec */
function odbc_do(Odbc\Connection $odbc, string $query): Odbc\Result|false {}
#ifdef PHP_ODBC_HAVE_FETCH_HASH
/** @param resource $statement */
function odbc_fetch_object($statement, ?int $row = null): stdClass|false {}
/** @param resource $statement */
function odbc_fetch_object($statement, ?int $row = null): stdClass|false {}
/** @param resource $statement */
function odbc_fetch_array($statement, ?int $row = null): array|false {}
/** @param resource $statement */
function odbc_fetch_array($statement, ?int $row = null): array|false {}
#endif
/**
* @param resource $statement
* @param array $array
*/
function odbc_fetch_into($statement, &$array, ?int $row = null): int|false {}
/**
* @param resource $statement
* @param array $array
*/
function odbc_fetch_into($statement, &$array, ?int $row = null): int|false {}
/** @param resource $statement */
function odbc_fetch_row($statement, ?int $row = null): bool {}
function odbc_fetch_row(Odbc\Result $statement, ?int $row = null): bool {}
/** @param resource $statement */
function odbc_result($statement, string|int $field): string|bool|null {}
function odbc_result(Odbc\Result $statement, string|int $field): string|bool|null {}
/**
* @param resource $statement
* @deprecated
*/
function odbc_result_all($statement, string $format = ""): int|false {}
/** @deprecated */
function odbc_result_all(Odbc\Result $statement, string $format = ""): int|false {}
/** @param resource $statement */
function odbc_free_result($statement): true {}
function odbc_free_result(Odbc\Result $statement): true {}
/**
* @return resource|false
*/
function odbc_connect(string $dsn, ?string $user = null, #[\SensitiveParameter] ?string $password = null, int $cursor_option = SQL_CUR_USE_DRIVER) {}
function odbc_connect(string $dsn, ?string $user = null, #[\SensitiveParameter] ?string $password = null, int $cursor_option = SQL_CUR_USE_DRIVER): Odbc\Connection|false {}
/**
* @return resource|false
*/
function odbc_pconnect(string $dsn, ?string $user = null, #[\SensitiveParameter] ?string $password = null, int $cursor_option = SQL_CUR_USE_DRIVER) {}
function odbc_pconnect(string $dsn, ?string $user = null, #[\SensitiveParameter] ?string $password = null, int $cursor_option = SQL_CUR_USE_DRIVER): Odbc\Connection|false {}
/** @param resource $odbc */
function odbc_close($odbc): void {}
function odbc_close(Odbc\Connection $odbc): void {}
/** @param resource $statement */
function odbc_num_rows($statement): int {}
function odbc_num_rows(Odbc\Result $statement): int {}
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
/** @param resource $statement */
function odbc_next_result($statement): bool {}
function odbc_next_result(Odbc\Result $statement): bool {}
#endif
/** @param resource $statement */
function odbc_num_fields($statement): int {}
function odbc_num_fields(Odbc\Result $statement): int {}
/** @param resource $statement */
function odbc_field_name($statement, int $field): string|false {}
function odbc_field_name(Odbc\Result $statement, int $field): string|false {}
/** @param resource $statement */
function odbc_field_type($statement, int $field): string|false {}
function odbc_field_type(Odbc\Result $statement, int $field): string|false {}
/** @param resource $statement */
function odbc_field_len($statement, int $field): int|false {}
function odbc_field_len(Odbc\Result $statement, int $field): int|false {}
/**
* @param resource $statement
* @alias odbc_field_len
*/
function odbc_field_precision($statement, int $field): int|false {}
/** @alias odbc_field_len */
function odbc_field_precision(Odbc\Result $statement, int $field): int|false {}
/** @param resource $statement */
function odbc_field_scale($statement, int $field): int|false {}
function odbc_field_scale(Odbc\Result $statement, int $field): int|false {}
/** @param resource $statement */
function odbc_field_num($statement, string $field): int|false {}
function odbc_field_num(Odbc\Result $statement, string $field): int|false {}
/** @param resource $odbc */
function odbc_autocommit($odbc, ?bool $enable = null): int|bool {}
function odbc_autocommit(Odbc\Connection $odbc, ?bool $enable = null): int|bool {}
/** @param resource $odbc */
function odbc_commit($odbc): bool {}
function odbc_commit(Odbc\Connection $odbc): bool {}
/** @param resource $odbc */
function odbc_rollback($odbc): bool {}
function odbc_rollback(Odbc\Connection $odbc): bool {}
/** @param resource|null $odbc */
function odbc_error($odbc = null): string {}
function odbc_error(?Odbc\Connection $odbc = null): string {}
/** @param resource|null $odbc */
function odbc_errormsg($odbc = null): string {}
function odbc_errormsg(?Odbc\Connection $odbc = null): string {}
/** @param resource $odbc */
function odbc_setoption($odbc, int $which, int $option, int $value): bool {}
function odbc_setoption(Odbc\Connection|Odbc\Result $odbc, int $which, int $option, int $value): bool {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_tables($odbc, ?string $catalog = null, ?string $schema = null, ?string $table = null, ?string $types = null) {}
function odbc_tables(Odbc\Connection $odbc, ?string $catalog = null, ?string $schema = null, ?string $table = null, ?string $types = null): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_columns($odbc, ?string $catalog = null, ?string $schema = null, ?string $table = null, ?string $column = null) {}
function odbc_columns(Odbc\Connection $odbc, ?string $catalog = null, ?string $schema = null, ?string $table = null, ?string $column = null): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_gettypeinfo($odbc, int $data_type = 0) {}
function odbc_gettypeinfo(Odbc\Connection $odbc, int $data_type = 0): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_primarykeys($odbc, ?string $catalog, string $schema, string $table) {}
function odbc_primarykeys(Odbc\Connection $odbc, ?string $catalog, string $schema, string $table): Odbc\Result|false {}
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_procedurecolumns($odbc, ?string $catalog = null, ?string $schema = null, ?string $procedure = null, ?string $column = null) {}
function odbc_procedurecolumns(Odbc\Connection $odbc, ?string $catalog = null, ?string $schema = null, ?string $procedure = null, ?string $column = null): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_procedures($odbc, ?string $catalog = null, ?string $schema = null, ?string $procedure = null) {}
function odbc_procedures(Odbc\Connection $odbc, ?string $catalog = null, ?string $schema = null, ?string $procedure = null): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_foreignkeys($odbc, ?string $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table) {}
function odbc_foreignkeys(Odbc\Connection $odbc, ?string $pk_catalog, string $pk_schema, string $pk_table, string $fk_catalog, string $fk_schema, string $fk_table): Odbc\Result|false {}
#endif
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_specialcolumns($odbc, int $type, ?string $catalog, string $schema, string $table, int $scope, int $nullable) {}
function odbc_specialcolumns(Odbc\Connection $odbc, int $type, ?string $catalog, string $schema, string $table, int $scope, int $nullable): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_statistics($odbc, ?string $catalog, string $schema, string $table, int $unique, int $accuracy) {}
function odbc_statistics(Odbc\Connection $odbc, ?string $catalog, string $schema, string $table, int $unique, int $accuracy): Odbc\Result|false {}
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_tableprivileges($odbc, ?string $catalog, string $schema, string $table) {}
function odbc_tableprivileges(Odbc\Connection $odbc, ?string $catalog, string $schema, string $table): Odbc\Result|false {}
/**
* @param resource $odbc
* @return resource|false
*/
function odbc_columnprivileges($odbc, ?string $catalog, string $schema, string $table, string $column) {}
function odbc_columnprivileges(Odbc\Connection $odbc, ?string $catalog, string $schema, string $table, string $column): Odbc\Result|false {}
#endif
/* odbc_utils.c */
/* odbc_utils.c */
function odbc_connection_string_is_quoted(string $str): bool {}
function odbc_connection_string_is_quoted(string $str): bool {}
function odbc_connection_string_should_quote(string $str): bool {}
function odbc_connection_string_should_quote(string $str): bool {}
function odbc_connection_string_quote(string $str): string {}
function odbc_connection_string_quote(string $str): string {}
}

120
ext/odbc/odbc_arginfo.h generated
View File

@@ -1,36 +1,36 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: a64be64f69159d0c8ad2c3b951c6451a040c3c73 */
* Stub hash: 34cebf41d91e4dacb8655a935c629ac62f0bb5ab */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close_all, 0, 0, IS_VOID, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_binmode, 0, 2, IS_TRUE, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_longreadlen, 0, 2, IS_TRUE, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO(0, length, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_prepare, 0, 0, 2)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_prepare, 0, 2, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, query, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_execute, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, params, IS_ARRAY, 0, "[]")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_cursor, 0, 1, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_END_ARG_INFO()
#if defined(HAVE_SQLDATASOURCES)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_data_source, 0, 2, MAY_BE_ARRAY|MAY_BE_NULL|MAY_BE_FALSE)
ZEND_ARG_INFO(0, odbc)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, fetch_type, IS_LONG, 0)
ZEND_END_ARG_INFO()
#endif
@@ -60,25 +60,25 @@ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_fetch_into, 0, 2, MAY_BE_LO
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_fetch_row, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\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_odbc_result, 0, 2, MAY_BE_STRING|MAY_BE_BOOL|MAY_BE_NULL)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_MASK(0, field, MAY_BE_STRING|MAY_BE_LONG, NULL)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_result_all, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, format, IS_STRING, 0, "\"\"")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_free_result, 0, 1, IS_TRUE, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_connect, 0, 0, 1)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_connect, 0, 1, Odbc\\Connection, MAY_BE_FALSE)
ZEND_ARG_TYPE_INFO(0, dsn, IS_STRING, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, user, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, password, IS_STRING, 1, "null")
@@ -88,30 +88,30 @@ ZEND_END_ARG_INFO()
#define arginfo_odbc_pconnect arginfo_odbc_connect
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_close, 0, 1, IS_VOID, 0)
ZEND_ARG_INFO(0, odbc)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_num_rows, 0, 1, IS_LONG, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_END_ARG_INFO()
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30)
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_next_result, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_END_ARG_INFO()
#endif
#define arginfo_odbc_num_fields arginfo_odbc_num_rows
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_name, 0, 2, MAY_BE_STRING|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_END_ARG_INFO()
#define arginfo_odbc_field_type arginfo_odbc_field_name
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_len, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_LONG, 0)
ZEND_END_ARG_INFO()
@@ -120,65 +120,65 @@ ZEND_END_ARG_INFO()
#define arginfo_odbc_field_scale arginfo_odbc_field_len
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_field_num, 0, 2, MAY_BE_LONG|MAY_BE_FALSE)
ZEND_ARG_INFO(0, statement)
ZEND_ARG_OBJ_INFO(0, statement, Odbc\\Result, 0)
ZEND_ARG_TYPE_INFO(0, field, IS_STRING, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_odbc_autocommit, 0, 1, MAY_BE_LONG|MAY_BE_BOOL)
ZEND_ARG_INFO(0, odbc)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_commit, 0, 1, _IS_BOOL, 0)
ZEND_ARG_INFO(0, odbc)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_END_ARG_INFO()
#define arginfo_odbc_rollback arginfo_odbc_commit
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_error, 0, 0, IS_STRING, 0)
ZEND_ARG_INFO_WITH_DEFAULT_VALUE(0, odbc, "null")
ZEND_ARG_OBJ_INFO_WITH_DEFAULT_VALUE(0, odbc, Odbc\\Connection, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_odbc_errormsg arginfo_odbc_error
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_odbc_setoption, 0, 4, _IS_BOOL, 0)
ZEND_ARG_INFO(0, odbc)
ZEND_ARG_OBJ_TYPE_MASK(0, odbc, Odbc\\Connection|Odbc\\Result, 0, NULL)
ZEND_ARG_TYPE_INFO(0, which, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, option, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tables, 0, 0, 1)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_tables, 0, 1, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, catalog, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, table, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, types, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columns, 0, 0, 1)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_columns, 0, 1, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, catalog, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, table, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, column, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_gettypeinfo, 0, 0, 1)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_gettypeinfo, 0, 1, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, data_type, IS_LONG, 0, "0")
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_primarykeys, 0, 0, 4)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_primarykeys, 0, 4, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
ZEND_END_ARG_INFO()
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedurecolumns, 0, 0, 1)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_procedurecolumns, 0, 1, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, catalog, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, procedure, IS_STRING, 1, "null")
@@ -187,8 +187,8 @@ ZEND_END_ARG_INFO()
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_procedures, 0, 0, 1)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_procedures, 0, 1, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, catalog, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, schema, IS_STRING, 1, "null")
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, procedure, IS_STRING, 1, "null")
@@ -196,8 +196,8 @@ ZEND_END_ARG_INFO()
#endif
#if !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) && !defined(HAVE_SOLID_35)
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_foreignkeys, 0, 7, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, pk_catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, pk_schema, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, pk_table, IS_STRING, 0)
@@ -207,8 +207,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_foreignkeys, 0, 0, 7)
ZEND_END_ARG_INFO()
#endif
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 7)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_specialcolumns, 0, 7, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, type, IS_LONG, 0)
ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
@@ -217,8 +217,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_specialcolumns, 0, 0, 7)
ZEND_ARG_TYPE_INFO(0, nullable, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_statistics, 0, 6, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
@@ -227,8 +227,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_statistics, 0, 0, 6)
ZEND_END_ARG_INFO()
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_tableprivileges, 0, 0, 4)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_tableprivileges, 0, 4, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
@@ -236,8 +236,8 @@ ZEND_END_ARG_INFO()
#endif
#if !defined(HAVE_DBMAKER) && !defined(HAVE_SOLID) && !defined(HAVE_SOLID_30) &&!defined(HAVE_SOLID_35)
ZEND_BEGIN_ARG_INFO_EX(arginfo_odbc_columnprivileges, 0, 0, 5)
ZEND_ARG_INFO(0, odbc)
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_odbc_columnprivileges, 0, 5, Odbc\\Result, MAY_BE_FALSE)
ZEND_ARG_OBJ_INFO(0, odbc, Odbc\\Connection, 0)
ZEND_ARG_TYPE_INFO(0, catalog, IS_STRING, 1)
ZEND_ARG_TYPE_INFO(0, schema, IS_STRING, 0)
ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0)
@@ -390,6 +390,14 @@ static const zend_function_entry ext_functions[] = {
ZEND_FE_END
};
static const zend_function_entry class_Odbc_Connection_methods[] = {
ZEND_FE_END
};
static const zend_function_entry class_Odbc_Result_methods[] = {
ZEND_FE_END
};
static void register_odbc_symbols(int module_number)
{
REGISTER_STRING_CONSTANT("ODBC_TYPE", PHP_ODBC_TYPE, CONST_PERSISTENT);
@@ -489,3 +497,25 @@ static void register_odbc_symbols(int module_number)
zend_add_parameter_attribute(zend_hash_str_find_ptr(CG(function_table), "odbc_pconnect", sizeof("odbc_pconnect") - 1), 2, ZSTR_KNOWN(ZEND_STR_SENSITIVEPARAMETER), 0);
}
static zend_class_entry *register_class_Odbc_Connection(void)
{
zend_class_entry ce, *class_entry;
INIT_NS_CLASS_ENTRY(ce, "Odbc", "Connection", class_Odbc_Connection_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
return class_entry;
}
static zend_class_entry *register_class_Odbc_Result(void)
{
zend_class_entry ce, *class_entry;
INIT_NS_CLASS_ENTRY(ce, "Odbc", "Result", class_Odbc_Result_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ZEND_ACC_NO_DYNAMIC_PROPERTIES|ZEND_ACC_NOT_SERIALIZABLE;
return class_entry;
}

File diff suppressed because it is too large Load Diff

View File

@@ -191,10 +191,16 @@ typedef struct odbc_connection {
ODBC_SQL_CONN_T hdbc;
char laststate[6];
char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
zend_resource *res;
int persistent;
HashTable results;
} odbc_connection;
typedef struct odbc_link {
odbc_connection *connection;
zend_string *hash;
bool persistent;
zend_object std;
} odbc_link;
typedef struct odbc_result_value {
char name[256];
char *value;
@@ -220,8 +226,10 @@ typedef struct odbc_result {
zend_long longreadlen;
int binmode;
int fetched;
odbc_param_info * param_info;
odbc_param_info *param_info;
odbc_connection *conn_ptr;
uint32_t index;
zend_object std;
} odbc_result;
ZEND_BEGIN_MODULE_GLOBALS(odbc)
@@ -240,8 +248,13 @@ ZEND_BEGIN_MODULE_GLOBALS(odbc)
zend_long default_cursortype;
char laststate[6];
char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
HashTable *resource_list;
HashTable *resource_plist;
/* Stores ODBC links throughout the duration of a request. The connection member may be either persistent or
* non-persistent. In the former case, it is a pointer to an item in EG(persistent_list). This solution makes it
* possible to properly free links during RSHUTDOWN (or when they are explicitly closed), while persistent
* connections themselves are going to be freed later during the shutdown process (or when they are explicitly
* closed).
*/
HashTable connections;
ZEND_END_MODULE_GLOBALS(odbc)
int odbc_add_result(HashTable *list, odbc_result *result);

View File

@@ -12,4 +12,5 @@ $conn = odbc_connect($dsn, $user, $pass);
var_dump(odbc_specialcolumns($conn, SQL_BEST_ROWID, '', '', '', SQL_SCOPE_CURROW, SQL_NO_NULLS));
?>
--EXPECTF--
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}

View File

@@ -11,6 +11,6 @@ try {
}
var_dump(STDIN);
?>
--EXPECTF--
odbc_close(): supplied resource is not a valid ODBC-Link resource
resource(%d) of type (stream)
--EXPECT--
odbc_close(): Argument #1 ($odbc) must be of type Odbc\Connection, resource given
resource(1) of type (stream)

View File

@@ -0,0 +1,62 @@
--TEST--
odbc_close(): Basic test
--EXTENSIONS--
odbc
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
include 'config.inc';
$conn1 = odbc_connect($dsn, $user, $pass);
$conn2 = odbc_pconnect($dsn, $user, $pass);
$result1 = odbc_columns($conn1, '', '', '', '');
$result2 = odbc_columns($conn2, '', '', '', '');
var_dump($conn1);
var_dump($conn2);
var_dump($result1);
var_dump($result2);
odbc_close($conn1);
odbc_close($conn2);
try {
odbc_columns($conn1, '', '', '', '');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_columns($conn2, '', '', '', '');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_num_rows($result1);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_num_rows($result2);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
object(Odbc\Connection)#%d (%d) {
}
object(Odbc\Connection)#%d (%d) {
}
object(Odbc\Result)#%d (%d) {
}
object(Odbc\Result)#%d (%d) {
}
ODBC connection has already been closed
ODBC connection has already been closed
ODBC result has already been closed
ODBC result has already been closed

View File

@@ -21,18 +21,41 @@ var_dump($result2);
odbc_close_all();
var_dump($conn1);
var_dump($conn2);
var_dump($result1);
var_dump($result2);
try {
odbc_columns($conn1, '', '', '', '');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_columns($conn2, '', '', '', '');
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_num_rows($result1);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
try {
odbc_num_rows($result2);
} catch (Error $e) {
echo $e->getMessage() . "\n";
}
?>
--EXPECTF--
resource(%d) of type (odbc link)
resource(%d) of type (odbc link persistent)
resource(%d) of type (odbc result)
resource(%d) of type (odbc result)
resource(%d) of type (Unknown)
resource(%d) of type (Unknown)
resource(%d) of type (Unknown)
resource(%d) of type (Unknown)
object(Odbc\Connection)#%d (%d) {
}
object(Odbc\Connection)#%d (%d) {
}
object(Odbc\Result)#%d (%d) {
}
object(Odbc\Result)#%d (%d) {
}
ODBC connection has already been closed
ODBC connection has already been closed
ODBC result has already been closed
ODBC result has already been closed

View File

@@ -22,7 +22,8 @@ var_dump(odbc_fetch_row($result));
?>
--EXPECTF--
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(false)
Deprecated: odbc_columnprivileges(): Passing null to parameter #3 ($schema) of type string is deprecated in %s on line %d
@@ -30,7 +31,9 @@ Deprecated: odbc_columnprivileges(): Passing null to parameter #3 ($schema) of t
Deprecated: odbc_columnprivileges(): Passing null to parameter #4 ($table) of type string is deprecated in %s on line %d
Deprecated: odbc_columnprivileges(): Passing null to parameter #5 ($column) of type string is deprecated in %s on line %d
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(false)
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(false)

View File

@@ -17,24 +17,36 @@ odbc_exec($conn, 'INSERT INTO free_result VALUES (1), (2)');
$res = odbc_exec($conn, 'SELECT * FROM free_result');
var_dump(odbc_fetch_row($res));
var_dump(odbc_result($res, 'test'));
var_dump(odbc_free_result($res));
try {
var_dump(odbc_free_result($conn));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_fetch_row($res));
} catch (TypeError $e) {
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_result($res, 'test'));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_free_result($res));
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_free_result($conn));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_fetch_row($res));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump(odbc_result($res, 'test'));
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--CLEAN--
<?php
@@ -46,6 +58,6 @@ odbc_exec($conn, 'DROP TABLE free_result');
bool(true)
string(1) "1"
bool(true)
odbc_free_result(): supplied resource is not a valid ODBC result resource
odbc_fetch_row(): supplied resource is not a valid ODBC result resource
odbc_result(): supplied resource is not a valid ODBC result resource
odbc_free_result(): Argument #1 ($statement) must be of type Odbc\Result, Odbc\Connection given
ODBC result has already been closed
ODBC result has already been closed

View File

@@ -0,0 +1,69 @@
--TEST--
odbc_pconnect(): Make sure non-persistent connections are reused
--EXTENSIONS--
odbc
--SKIPIF--
<?php
if (getenv('SKIP_ASAN')) {
die('skip libmsodbcsql leaks, see https://github.com/php/php-src/pull/12132#issuecomment-1710392299.');
}
include 'skipif.inc';
// The test can affect multiple drivers, but testing it is driver-specific.
// Since CI runs ODBC tests with SQL Server, just use an SQL Server specific way of testing.
$conn = odbc_connect($dsn, $user, $pass);
$result = @odbc_exec($conn, "SELECT @@Version");
if ($result) {
$array = odbc_fetch_array($result);
$info = (string) reset($array);
if (!str_contains($info, "Microsoft SQL Server")) {
echo "skip MS SQL specific test";
}
}
?>
--FILE--
<?php
include 'config.inc';
// set a session specific variable via CONTEXT_INFO, if we get the same connection again, it should be identical
function set_context_info($conn, $string) {
$hexstring = bin2hex($string);
return odbc_exec($conn, "SET CONTEXT_INFO 0x$hexstring");
}
function fetch_context_info($conn) {
$stmt = odbc_exec($conn, "SELECT CONTEXT_INFO() AS CONTEXT_INFO");
if (!$stmt) {
return false;
}
$res = odbc_fetch_array($stmt);
if ($res) {
// this is a binary, so we get a bunch of nulls at the end
return $res["CONTEXT_INFO"] ? trim($res["CONTEXT_INFO"]) : null;
} else {
return false;
}
}
// run 1: set expectations
$conn = odbc_connect($dsn, $user, $pass);
set_context_info($conn, "PHP odbc_connect test");
var_dump(fetch_context_info($conn));
// run 2: reuse same connection (imagine this is another request)
$conn = odbc_connect($dsn, $user, $pass);
var_dump(fetch_context_info($conn));
// run 3: close it and see if it's the same connection
odbc_close($conn);
$conn = odbc_connect($dsn, $user, $pass);
var_dump(fetch_context_info($conn));
?>
--EXPECT--
string(21) "PHP odbc_connect test"
string(21) "PHP odbc_connect test"
NULL

View File

@@ -0,0 +1,69 @@
--TEST--
odbc_pconnect(): Make sure closing a persistent connection works in case of odbc_close_all()
--EXTENSIONS--
odbc
--SKIPIF--
<?php
if (getenv('SKIP_ASAN')) {
die('skip libmsodbcsql leaks, see https://github.com/php/php-src/pull/12132#issuecomment-1710392299.');
}
include 'skipif.inc';
// The test can affect multiple drivers, but testing it is driver-specific.
// Since CI runs ODBC tests with SQL Server, just use an SQL Server specific way of testing.
$conn = odbc_connect($dsn, $user, $pass);
$result = @odbc_exec($conn, "SELECT @@Version");
if ($result) {
$array = odbc_fetch_array($result);
$info = (string) reset($array);
if (!str_contains($info, "Microsoft SQL Server")) {
echo "skip MS SQL specific test";
}
}
?>
--FILE--
<?php
include 'config.inc';
// set a session specific variable via CONTEXT_INFO, if we get the same connection again, it should be identical
function set_context_info($conn, $string) {
$hexstring = bin2hex($string);
return odbc_exec($conn, "SET CONTEXT_INFO 0x$hexstring");
}
function fetch_context_info($conn) {
$stmt = odbc_exec($conn, "SELECT CONTEXT_INFO() AS CONTEXT_INFO");
if (!$stmt) {
return false;
}
$res = odbc_fetch_array($stmt);
if ($res) {
// this is a binary, so we get a bunch of nulls at the end
return $res["CONTEXT_INFO"] ? trim($res["CONTEXT_INFO"]) : null;
} else {
return false;
}
}
// run 1: set expectations
$conn = odbc_pconnect($dsn, $user, $pass);
set_context_info($conn, "PHP odbc_pconnect test");
var_dump(fetch_context_info($conn));
// run 2: reuse same connection (imagine this is another request)
$conn = odbc_pconnect($dsn, $user, $pass);
var_dump(fetch_context_info($conn));
// run 3: close it and see if it's the same connection
odbc_close_all();
$conn = odbc_pconnect($dsn, $user, $pass);
var_dump(fetch_context_info($conn));
?>
--EXPECT--
string(22) "PHP odbc_pconnect test"
string(22) "PHP odbc_pconnect test"
NULL

View File

@@ -27,13 +27,17 @@ var_dump(odbc_fetch_row($result));
?>
--EXPECTF--
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(false)
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(true)
bool(true)
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(true)
bool(true)
resource(%d) of type (odbc result)
object(Odbc\Result)#%d (%d) {
}
bool(false)