Skip to content

ext/pdo_firebird: Added Pdo\Firebird::ATTR_API_VERSION #14916

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ext/pdo_firebird/firebird_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions ext/pdo_firebird/pdo_firebird.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
/* }}} */
3 changes: 3 additions & 0 deletions ext/pdo_firebird/pdo_firebird.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 7 additions & 1 deletion ext/pdo_firebird/pdo_firebird_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ext/pdo_firebird/php_pdo_firebird_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions ext/pdo_firebird/tests/get_api_version.phpt
Original file line number Diff line number Diff line change
@@ -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