mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION (#14916)
closes #14916
This commit is contained in:
parent
b2c3f2fead
commit
d55ef3f339
8 changed files with 45 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -8,6 +8,9 @@ PHP NEWS
|
|||
- OpenSSL:
|
||||
. Bumped minimum required OpenSSL version to 1.1.0. (cmb)
|
||||
|
||||
- PDO_FIREBIRD:
|
||||
. Added Pdo\Firebird::ATTR_API_VERSION. (SakiTakamachi)
|
||||
|
||||
- Standard:
|
||||
. Fix references in request_parse_body() options array. (nielsdos)
|
||||
|
||||
|
|
|
@ -509,6 +509,9 @@ PHP 8.4 UPGRADE NOTES
|
|||
PDO::FB_WRITABLE_TRANSACTION) have been added.
|
||||
. When using persistent connections, there is now a liveness check in the
|
||||
constructor.
|
||||
. The content that is built changes depending on the value of FB_API_VER in
|
||||
ibase.h, so added the attribute value Pdo\Firebird::ATTR_API_VERSION to
|
||||
obtain that value. This value can also be referenced from phpinfo.
|
||||
|
||||
- PDO_MYSQL:
|
||||
. getAttribute, enabled to get the value of ATTR_FETCH_TABLE_NAMES.
|
||||
|
@ -805,7 +808,7 @@ PHP 8.4 UPGRADE NOTES
|
|||
. P_GID (NetBSD/FreeBSD only).
|
||||
. P_SID (NetBSD/FreeBSD only).
|
||||
. P_JAILID (FreeBSD only).
|
||||
|
||||
|
||||
- Standard:
|
||||
. PHP_ROUND_CEILING.
|
||||
. PHP_ROUND_FLOOR.
|
||||
|
|
|
@ -1177,6 +1177,10 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val)
|
|||
}
|
||||
return 1;
|
||||
|
||||
case PDO_FB_ATTR_API_VERSION:
|
||||
ZVAL_LONG(val, FB_API_VER);
|
||||
return 1;
|
||||
|
||||
case PDO_ATTR_SERVER_VERSION:
|
||||
case PDO_ATTR_SERVER_INFO:
|
||||
*tmp = 0;
|
||||
|
|
|
@ -93,11 +93,15 @@ PHP_MSHUTDOWN_FUNCTION(pdo_firebird) /* {{{ */
|
|||
PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
|
||||
{
|
||||
char version[64];
|
||||
char api_version[8];
|
||||
isc_get_client_version(version);
|
||||
|
||||
snprintf(api_version, 7, "%d", FB_API_VER);
|
||||
|
||||
php_info_print_table_start();
|
||||
php_info_print_table_row(2, "PDO Driver for Firebird", "enabled");
|
||||
php_info_print_table_row(2, "Client Library Version", version);
|
||||
php_info_print_table_row(2, "Firebird API version", api_version);
|
||||
php_info_print_table_end();
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -19,6 +19,9 @@ class Firebird extends PDO
|
|||
/** @cvalue PDO_FB_ATTR_TIMESTAMP_FORMAT */
|
||||
public const int ATTR_TIMESTAMP_FORMAT = UNKNOWN;
|
||||
|
||||
/** @cvalue PDO_FB_ATTR_API_VERSION */
|
||||
public const int ATTR_API_VERSION = UNKNOWN;
|
||||
|
||||
/** @cvalue PDO_FB_TRANSACTION_ISOLATION_LEVEL */
|
||||
public const int TRANSACTION_ISOLATION_LEVEL = UNKNOWN;
|
||||
|
||||
|
|
8
ext/pdo_firebird/pdo_firebird_arginfo.h
generated
8
ext/pdo_firebird/pdo_firebird_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
|||
/* This is a generated file, edit the .stub.php file instead.
|
||||
* Stub hash: 584b20b65c1ebccf82f894cb9e16ea76a2b1aa1e */
|
||||
* Stub hash: 84acb963a6d147625c986e66ec313a0927314af2 */
|
||||
|
||||
static const zend_function_entry class_Pdo_Firebird_methods[] = {
|
||||
ZEND_FE_END
|
||||
|
@ -31,6 +31,12 @@ static zend_class_entry *register_class_Pdo_Firebird(zend_class_entry *class_ent
|
|||
zend_declare_typed_class_constant(class_entry, const_ATTR_TIMESTAMP_FORMAT_name, &const_ATTR_TIMESTAMP_FORMAT_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_ATTR_TIMESTAMP_FORMAT_name);
|
||||
|
||||
zval const_ATTR_API_VERSION_value;
|
||||
ZVAL_LONG(&const_ATTR_API_VERSION_value, PDO_FB_ATTR_API_VERSION);
|
||||
zend_string *const_ATTR_API_VERSION_name = zend_string_init_interned("ATTR_API_VERSION", sizeof("ATTR_API_VERSION") - 1, 1);
|
||||
zend_declare_typed_class_constant(class_entry, const_ATTR_API_VERSION_name, &const_ATTR_API_VERSION_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||
zend_string_release(const_ATTR_API_VERSION_name);
|
||||
|
||||
zval const_TRANSACTION_ISOLATION_LEVEL_value;
|
||||
ZVAL_LONG(&const_TRANSACTION_ISOLATION_LEVEL_value, PDO_FB_TRANSACTION_ISOLATION_LEVEL);
|
||||
zend_string *const_TRANSACTION_ISOLATION_LEVEL_name = zend_string_init_interned("TRANSACTION_ISOLATION_LEVEL", sizeof("TRANSACTION_ISOLATION_LEVEL") - 1, 1);
|
||||
|
|
|
@ -142,6 +142,7 @@ enum {
|
|||
PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
|
||||
PDO_FB_ATTR_TIME_FORMAT,
|
||||
PDO_FB_ATTR_TIMESTAMP_FORMAT,
|
||||
PDO_FB_ATTR_API_VERSION,
|
||||
|
||||
/*
|
||||
* transaction isolation level
|
||||
|
|
19
ext/pdo_firebird/tests/get_api_version.phpt
Normal file
19
ext/pdo_firebird/tests/get_api_version.phpt
Normal file
|
@ -0,0 +1,19 @@
|
|||
--TEST--
|
||||
PDO_Firebird: get api version
|
||||
--EXTENSIONS--
|
||||
pdo_firebird
|
||||
--SKIPIF--
|
||||
<?php require('skipif.inc'); ?>
|
||||
--XLEAK--
|
||||
A bug in firebird causes a memory leak when calling `isc_attach_database()`.
|
||||
See https://github.com/FirebirdSQL/firebird/issues/7849
|
||||
--FILE--
|
||||
<?php
|
||||
require("testdb.inc");
|
||||
$dbh = getDbConnection();
|
||||
echo $dbh->getAttribute(Pdo\Firebird::ATTR_API_VERSION) . "\n";
|
||||
echo 'done!';
|
||||
?>
|
||||
--EXPECTF--
|
||||
%d
|
||||
done!
|
Loading…
Add table
Add a link
Reference in a new issue