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

ext/pdo_firebird: Added getApiVersion() and removed from getAttribute (#15004)

This commit is contained in:
Saki Takamachi
2024-07-18 11:17:52 +09:00
committed by GitHub
parent 4cb82b039e
commit c550d341ff
8 changed files with 24 additions and 21 deletions

2
NEWS
View File

@@ -10,6 +10,8 @@ PHP NEWS
- PDO_FIREBIRD:
. Added Pdo\Firebird::ATTR_API_VERSION. (SakiTakamachi)
. Added getApiVersion() and removed from getAttribute().
(SakiTakamachi)
- Standard:
. Fix references in request_parse_body() options array. (nielsdos)

View File

@@ -510,8 +510,8 @@ PHP 8.4 UPGRADE NOTES
. 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.
ibase.h, so added static method Pdo\Firebird::getApiVersion() 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.

View File

@@ -1177,10 +1177,6 @@ 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;

View File

@@ -100,3 +100,12 @@ PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
php_info_print_table_end();
}
/* }}} */
PHP_METHOD(Pdo_Firebird, getApiVersion)
{
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
RETURN_LONG(FB_API_VER);
}

View File

@@ -19,9 +19,6 @@ 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;
@@ -36,4 +33,6 @@ class Firebird extends \PDO
/** @cvalue PDO_FB_WRITABLE_TRANSACTION */
public const int WRITABLE_TRANSACTION = UNKNOWN;
public static function getApiVersion(): int {}
}

View File

@@ -1,7 +1,13 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: bc0f434e238c1087e292be0d4a7a04aa4718a6bc */
* Stub hash: d36b2055abc48ae91c3442dda68fa2a28eb6d25b */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Firebird_getApiVersion, 0, 0, IS_LONG, 0)
ZEND_END_ARG_INFO()
ZEND_METHOD(Pdo_Firebird, getApiVersion);
static const zend_function_entry class_Pdo_Firebird_methods[] = {
ZEND_ME(Pdo_Firebird, getApiVersion, arginfo_class_Pdo_Firebird_getApiVersion, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
ZEND_FE_END
};
@@ -31,12 +37,6 @@ 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);

View File

@@ -142,7 +142,6 @@ 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

View File

@@ -1,5 +1,5 @@
--TEST--
PDO_Firebird: get api version
PDO_Firebird: getApiVersion()
--EXTENSIONS--
pdo_firebird
--SKIPIF--
@@ -9,9 +9,7 @@ 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 Pdo\Firebird::getApiVersion() . "\n";
echo 'done!';
?>
--EXPECTF--