From 06fd88186271260bd623db039ac48bcc2d342886 Mon Sep 17 00:00:00 2001 From: Simonov Denis Date: Sun, 18 Aug 2024 10:14:53 +0300 Subject: [PATCH 1/6] add connection level SESSION_TIMEZONE attribute --- ext/pdo_firebird/firebird_driver.c | 22 ++++++- ext/pdo_firebird/pdo_firebird.stub.php | 3 + ext/pdo_firebird/pdo_firebird_arginfo.h | 6 ++ ext/pdo_firebird/php_pdo_firebird_int.h | 3 + .../tests/fb4_session_timezone.phpt | 59 +++++++++++++++++++ 5 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 ext/pdo_firebird/tests/fb4_session_timezone.phpt diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index a044cd6400519..11220632ea837 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -1437,9 +1437,21 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* } do { +#if FB_API_VER >= 40 + zend_string *session_timezone = pdo_attr_strval(driver_options, PDO_FB_SESSION_TIMEZONE, NULL); +#endif + static char const dpb_flags[] = { - isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name }; - char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval }; + isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name +#if FB_API_VER >= 40 + , isc_dpb_session_time_zone +#endif + }; + char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval +#if FB_API_VER >= 40 + , session_timezone ? ZSTR_VAL(session_timezone) : NULL +#endif + }; char dpb_buffer[256] = { isc_dpb_version1 }, *dpb; dpb = dpb_buffer + 1; @@ -1454,6 +1466,12 @@ static int pdo_firebird_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* } } +#if FB_API_VER >= 40 + if (session_timezone) { + zend_string_release_ex(session_timezone, 0); + } +#endif + H->sql_dialect = PDO_FB_DIALECT; if (vars[3].optval) { H->sql_dialect = atoi(vars[3].optval); diff --git a/ext/pdo_firebird/pdo_firebird.stub.php b/ext/pdo_firebird/pdo_firebird.stub.php index f8c9ea46fcb07..2338c89089ba6 100644 --- a/ext/pdo_firebird/pdo_firebird.stub.php +++ b/ext/pdo_firebird/pdo_firebird.stub.php @@ -33,6 +33,9 @@ class Firebird extends \PDO /** @cvalue PDO_FB_WRITABLE_TRANSACTION */ public const int WRITABLE_TRANSACTION = UNKNOWN; + + /** @cvalue PDO_FB_SESSION_TIMEZONE */ + public const int SESSION_TIMEZONE = UNKNOWN; public static function getApiVersion(): int {} } diff --git a/ext/pdo_firebird/pdo_firebird_arginfo.h b/ext/pdo_firebird/pdo_firebird_arginfo.h index a751751edb635..e1f2fabda14d0 100644 --- a/ext/pdo_firebird/pdo_firebird_arginfo.h +++ b/ext/pdo_firebird/pdo_firebird_arginfo.h @@ -66,6 +66,12 @@ static zend_class_entry *register_class_Pdo_Firebird(zend_class_entry *class_ent zend_string *const_WRITABLE_TRANSACTION_name = zend_string_init_interned("WRITABLE_TRANSACTION", sizeof("WRITABLE_TRANSACTION") - 1, 1); zend_declare_typed_class_constant(class_entry, const_WRITABLE_TRANSACTION_name, &const_WRITABLE_TRANSACTION_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(const_WRITABLE_TRANSACTION_name); + + zval const_SESSION_TIMEZONE_value; + ZVAL_LONG(&const_SESSION_TIMEZONE_value, PDO_FB_SESSION_TIMEZONE); + zend_string *const_SESSION_TIMEZONE_name = zend_string_init_interned("SESSION_TIMEZONE", sizeof("SESSION_TIMEZONE") - 1, 1); + zend_declare_typed_class_constant(class_entry, const_SESSION_TIMEZONE_name, &const_SESSION_TIMEZONE_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); + zend_string_release(const_SESSION_TIMEZONE_name); return class_entry; } diff --git a/ext/pdo_firebird/php_pdo_firebird_int.h b/ext/pdo_firebird/php_pdo_firebird_int.h index dc1e4bb7f4086..d2f0b410579fe 100644 --- a/ext/pdo_firebird/php_pdo_firebird_int.h +++ b/ext/pdo_firebird/php_pdo_firebird_int.h @@ -154,6 +154,9 @@ enum { /* transaction access mode */ PDO_FB_WRITABLE_TRANSACTION, + + /* session time zone */ + PDO_FB_SESSION_TIMEZONE, }; #endif /* PHP_PDO_FIREBIRD_INT_H */ diff --git a/ext/pdo_firebird/tests/fb4_session_timezone.phpt b/ext/pdo_firebird/tests/fb4_session_timezone.phpt new file mode 100644 index 0000000000000..c3a4d869c15e0 --- /dev/null +++ b/ext/pdo_firebird/tests/fb4_session_timezone.phpt @@ -0,0 +1,59 @@ +--TEST-- +PDO_Firebird: Firebird 4.0 set session time zone +--EXTENSIONS-- +pdo_firebird +--SKIPIF-- +query("SELECT RDB\$get_context('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); +$data = $stmt->fetch(\PDO::FETCH_ASSOC); +if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], '4.0.0') < 0) { + die("skip Firebird Server version must be greater than or equal to 4.0.0"); +} +?> +--XLEAK-- +A bug in firebird causes a memory leak when calling `isc_attach_database()`. +See https://github.com/FirebirdSQL/firebird/issues/7849 +--FILE-- + 'Europe/Rome', + ], +); + +$stmt = $dbh->prepare($sql); +$stmt->execute(); +$data = $stmt->fetch(\PDO::FETCH_ASSOC); +$stmt->closeCursor(); + +var_dump($data); +echo "\ndone\n"; +?> +--EXPECT-- +array(3) { + ["TZ"]=> + string(11) "Europe/Rome" + ["TZ1"]=> + string(11) "Europe/Rome" + ["TZ2"]=> + string(11) "Europe/Rome" +} + +done From 47c92e4681791e77febf36e92d1c6c2897c16638 Mon Sep 17 00:00:00 2001 From: Simonov Denis Date: Sun, 18 Aug 2024 10:48:34 +0300 Subject: [PATCH 2/6] fixed autogenerated file --- ext/pdo_firebird/pdo_firebird_arginfo.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/pdo_firebird/pdo_firebird_arginfo.h b/ext/pdo_firebird/pdo_firebird_arginfo.h index e1f2fabda14d0..5235888d7a225 100644 --- a/ext/pdo_firebird/pdo_firebird_arginfo.h +++ b/ext/pdo_firebird/pdo_firebird_arginfo.h @@ -1,5 +1,5 @@ /* This is a generated file, edit the .stub.php file instead. - * Stub hash: d36b2055abc48ae91c3442dda68fa2a28eb6d25b */ + * Stub hash: 37ad789e2e14cb6cad05bb1a41adfee4e9194e02 */ ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class_Pdo_Firebird_getApiVersion, 0, 0, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -66,12 +66,12 @@ static zend_class_entry *register_class_Pdo_Firebird(zend_class_entry *class_ent zend_string *const_WRITABLE_TRANSACTION_name = zend_string_init_interned("WRITABLE_TRANSACTION", sizeof("WRITABLE_TRANSACTION") - 1, 1); zend_declare_typed_class_constant(class_entry, const_WRITABLE_TRANSACTION_name, &const_WRITABLE_TRANSACTION_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); zend_string_release(const_WRITABLE_TRANSACTION_name); - + zval const_SESSION_TIMEZONE_value; ZVAL_LONG(&const_SESSION_TIMEZONE_value, PDO_FB_SESSION_TIMEZONE); zend_string *const_SESSION_TIMEZONE_name = zend_string_init_interned("SESSION_TIMEZONE", sizeof("SESSION_TIMEZONE") - 1, 1); zend_declare_typed_class_constant(class_entry, const_SESSION_TIMEZONE_name, &const_SESSION_TIMEZONE_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG)); - zend_string_release(const_SESSION_TIMEZONE_name); + zend_string_release(const_SESSION_TIMEZONE_name); return class_entry; } From 9b621c7ee19560d2f93d0d90fe0706b8a9d9bb38 Mon Sep 17 00:00:00 2001 From: Simonov Denis Date: Sun, 18 Aug 2024 14:21:06 +0300 Subject: [PATCH 3/6] Simplified checks for tests --- ext/pdo_firebird/tests/fb4_datatypes.phpt | 8 +------- .../tests/fb4_datatypes_params.phpt | 8 +------- .../tests/fb4_session_timezone.phpt | 18 ++++-------------- ext/pdo_firebird/tests/testdb.inc | 18 ++++++++++++++---- 4 files changed, 20 insertions(+), 32 deletions(-) diff --git a/ext/pdo_firebird/tests/fb4_datatypes.phpt b/ext/pdo_firebird/tests/fb4_datatypes.phpt index 7acf338be27c9..dcd4846da29e5 100644 --- a/ext/pdo_firebird/tests/fb4_datatypes.phpt +++ b/ext/pdo_firebird/tests/fb4_datatypes.phpt @@ -8,19 +8,13 @@ if (Pdo\Firebird::getApiVersion() < 40) { die('skip: Firebird API version must be greater than or equal to 40'); } require 'testdb.inc'; -$dbh = getDbConnection(); -$stmt = $dbh->query("SELECT RDB\$get_context('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); -$data = $stmt->fetch(\PDO::FETCH_ASSOC); -if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], '4.0.0') < 0) { - die("skip Firebird Server version must be greater than or equal to 4.0.0"); -} +checkMinServerVersion('4.0.0'); ?> --XLEAK-- A bug in firebird causes a memory leak when calling `isc_attach_database()`. See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- query("SELECT RDB\$get_context('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); -$data = $stmt->fetch(\PDO::FETCH_ASSOC); -if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], '4.0.0') < 0) { - die("skip Firebird Server version must be greater than or equal to 4.0.0"); -} +checkMinServerVersion('4.0.0'); ?> --XLEAK-- A bug in firebird causes a memory leak when calling `isc_attach_database()`. See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- query("SELECT RDB\$get_context('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); -$data = $stmt->fetch(\PDO::FETCH_ASSOC); -if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], '4.0.0') < 0) { - die("skip Firebird Server version must be greater than or equal to 4.0.0"); -} +checkMinServerVersion('4.0.0'); ?> --XLEAK-- A bug in firebird causes a memory leak when calling `isc_attach_database()`. @@ -29,14 +24,9 @@ $sql = <<<'SQL' FROM rdb$database SQL; -$dbh = new PDO( - PDO_FIREBIRD_TEST_DSN, - PDO_FIREBIRD_TEST_USER, - PDO_FIREBIRD_TEST_PASS, - [ - Pdo\Firebird::SESSION_TIMEZONE => 'Europe/Rome', - ], -); +$dbh = connectToDb([ + Pdo\Firebird::SESSION_TIMEZONE => 'Europe/Rome', +]); $stmt = $dbh->prepare($sql); $stmt->execute(); diff --git a/ext/pdo_firebird/tests/testdb.inc b/ext/pdo_firebird/tests/testdb.inc index 6be882297188b..8ca41d7a5e447 100644 --- a/ext/pdo_firebird/tests/testdb.inc +++ b/ext/pdo_firebird/tests/testdb.inc @@ -14,15 +14,25 @@ define('PDO_FIREBIRD_TEST_DSN', getenv('PDO_FIREBIRD_TEST_DSN') ?: ''); if(!PDO_FIREBIRD_TEST_DSN) { - die('Error: PDO_FIREBIRD_TEST_DSN must be set'); + die('Error: PDO_FIREBIRD_TEST_DSN must be set'); } function getDbConnection($class = PDO::class): PDO { - return new $class(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS); + return new $class(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS); } -function connectToDb(): Pdo\Firebird { - return Pdo\Firebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS); +function connectToDb(array $params = []): Pdo\Firebird { + return Pdo\Firebird::connect(PDO_FIREBIRD_TEST_DSN, PDO_FIREBIRD_TEST_USER, PDO_FIREBIRD_TEST_PASS, $params); +} + +function checkMinServerVersion(string $version): void +{ + $dbh = connectToDb(); + $stmt = $dbh->query("SELECT RDB\$GET_CONTEXT('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); + $data = $stmt->fetch(\PDO::FETCH_ASSOC); + if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], $version) < 0) { + die("skip Firebird Server version must be greater than or equal to $version"); + } } ?> From 83f35359b65d7e862f360f86d800a97a19cbefb1 Mon Sep 17 00:00:00 2001 From: Simonov Denis Date: Sun, 18 Aug 2024 14:45:54 +0300 Subject: [PATCH 4/6] tab to space --- ext/pdo_firebird/tests/fb4_datatypes.phpt | 26 +++++++++---------- .../tests/fb4_datatypes_params.phpt | 20 +++++++------- .../tests/fb4_session_timezone.phpt | 12 ++++----- ext/pdo_firebird/tests/testdb.inc | 16 ++++++------ 4 files changed, 37 insertions(+), 37 deletions(-) diff --git a/ext/pdo_firebird/tests/fb4_datatypes.phpt b/ext/pdo_firebird/tests/fb4_datatypes.phpt index dcd4846da29e5..4c10fa0e3a439 100644 --- a/ext/pdo_firebird/tests/fb4_datatypes.phpt +++ b/ext/pdo_firebird/tests/fb4_datatypes.phpt @@ -5,7 +5,7 @@ pdo_firebird --SKIPIF-- query("SELECT RDB\$GET_CONTEXT('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); - $data = $stmt->fetch(\PDO::FETCH_ASSOC); - if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], $version) < 0) { - die("skip Firebird Server version must be greater than or equal to $version"); - } + $dbh = connectToDb(); + $stmt = $dbh->query("SELECT RDB\$GET_CONTEXT('SYSTEM', 'ENGINE_VERSION') AS VERSION FROM RDB\$DATABASE"); + $data = $stmt->fetch(\PDO::FETCH_ASSOC); + if (!$data || !array_key_exists('VERSION', $data) || version_compare($data['VERSION'], $version) < 0) { + die("skip Firebird Server version must be greater than or equal to $version"); + } } ?> From adf9826656b578e46297b17ae8f9f4724c6d2d63 Mon Sep 17 00:00:00 2001 From: Simonov Denis Date: Sun, 18 Aug 2024 15:25:52 +0300 Subject: [PATCH 5/6] fixed windows test --- ext/pdo_firebird/tests/fb4_datatypes.phpt | 1 + ext/pdo_firebird/tests/fb4_datatypes_params.phpt | 1 + ext/pdo_firebird/tests/fb4_session_timezone.phpt | 1 + 3 files changed, 3 insertions(+) diff --git a/ext/pdo_firebird/tests/fb4_datatypes.phpt b/ext/pdo_firebird/tests/fb4_datatypes.phpt index 4c10fa0e3a439..23874285713a6 100644 --- a/ext/pdo_firebird/tests/fb4_datatypes.phpt +++ b/ext/pdo_firebird/tests/fb4_datatypes.phpt @@ -15,6 +15,7 @@ A bug in firebird causes a memory leak when calling `isc_attach_database()`. See https://github.com/FirebirdSQL/firebird/issues/7849 --FILE-- Date: Tue, 20 Aug 2024 19:23:59 +0300 Subject: [PATCH 6/6] code cleanup --- ext/pdo_firebird/firebird_driver.c | 60 --------------------------- ext/pdo_firebird/firebird_statement.c | 16 +++---- 2 files changed, 9 insertions(+), 67 deletions(-) diff --git a/ext/pdo_firebird/firebird_driver.c b/ext/pdo_firebird/firebird_driver.c index 11220632ea837..0d7f0d2a46d80 100644 --- a/ext/pdo_firebird/firebird_driver.c +++ b/ext/pdo_firebird/firebird_driver.c @@ -463,53 +463,6 @@ static int php_firebird_preprocess(const zend_string* sql, char* sql_out, HashTa #if FB_API_VER >= 40 /* set coercing a data type */ -static void set_coercing_input_data_types(XSQLDA* sqlda) -{ - /* Data types introduced in Firebird 4.0 are difficult to process using the Firebird Legacy API. */ - /* These data types include DECFLOAT(16), DECFLOAT(34), INT128 (NUMERIC/DECIMAL(38, x)), */ - /* TIMESTAMP WITH TIME ZONE, and TIME WITH TIME ZONE. */ - /* This function allows you to ensure minimal performance */ - /* of queries if they contain parameters of the above types. */ - unsigned int i; - short dtype; - short nullable; - XSQLVAR* var; - for (i=0, var = sqlda->sqlvar; i < sqlda->sqld; i++, var++) { - dtype = (var->sqltype & ~1); /* drop flag bit */ - nullable = (var->sqltype & 1); - switch(dtype) { - case SQL_INT128: - var->sqltype = SQL_VARYING + nullable; - var->sqllen = 46; - var->sqlscale = 0; - break; - - case SQL_DEC16: - var->sqltype = SQL_VARYING + nullable; - var->sqllen = 24; - break; - - case SQL_DEC34: - var->sqltype = SQL_VARYING + nullable; - var->sqllen = 43; - break; - - case SQL_TIMESTAMP_TZ: - var->sqltype = SQL_VARYING + nullable; - var->sqllen = 58; - break; - - case SQL_TIME_TZ: - var->sqltype = SQL_VARYING + nullable; - var->sqllen = 46; - break; - - default: - break; - } - } -} - static void set_coercing_output_data_types(XSQLDA* sqlda) { /* Data types introduced in Firebird 4.0 are difficult to process using the Firebird Legacy API. */ @@ -602,14 +555,12 @@ void php_firebird_set_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, const char *state, einfo->errmsg_length = read_len; einfo->errmsg = pestrndup(buf, read_len, dbh->is_persistent); -#if FB_API_VER >= 25 char sqlstate[sizeof(pdo_error_type)]; fb_sqlstate(sqlstate, H->isc_status); if (sqlstate != NULL && strlen(sqlstate) < sizeof(pdo_error_type)) { strcpy(*error_code, sqlstate); goto end; } -#endif } else if (msg && msg_len) { einfo->errmsg_length = msg_len; einfo->errmsg = pestrndup(msg, einfo->errmsg_length, dbh->is_persistent); @@ -730,11 +681,6 @@ static bool firebird_handle_preparer(pdo_dbh_t *dbh, zend_string *sql, /* {{{ */ if (isc_dsql_describe_bind(H->isc_status, &s, PDO_FB_SQLDA_VERSION, S->in_sqlda)) { break; } - -#if FB_API_VER >= 40 - /* set coercing a data type */ - set_coercing_input_data_types(S->in_sqlda); -#endif } stmt->driver_data = S; @@ -1333,7 +1279,6 @@ static int pdo_firebird_get_attribute(pdo_dbh_t *dbh, zend_long attr, zval *val) } /* }}} */ -#if FB_API_VER >= 30 /* called by PDO to check liveness */ static zend_result pdo_firebird_check_liveness(pdo_dbh_t *dbh) /* {{{ */ { @@ -1343,7 +1288,6 @@ static zend_result pdo_firebird_check_liveness(pdo_dbh_t *dbh) /* {{{ */ return fb_ping(H->isc_status, &H->db) ? FAILURE : SUCCESS; } /* }}} */ -#endif /* called by PDO to retrieve driver-specific information about an error that has occurred */ static void pdo_firebird_fetch_error_func(pdo_dbh_t *dbh, pdo_stmt_t *stmt, zval *info) /* {{{ */ @@ -1383,11 +1327,7 @@ static const struct pdo_dbh_methods firebird_methods = { /* {{{ */ NULL, /* last_id not supported */ pdo_firebird_fetch_error_func, pdo_firebird_get_attribute, -#if FB_API_VER >= 30 pdo_firebird_check_liveness, -#else - NULL, -#endif NULL, /* get driver methods */ NULL, /* request shutdown */ pdo_firebird_in_manually_transaction, diff --git a/ext/pdo_firebird/firebird_statement.c b/ext/pdo_firebird/firebird_statement.c index 5cc8889c65e79..ce7bc822139ee 100644 --- a/ext/pdo_firebird/firebird_statement.c +++ b/ext/pdo_firebird/firebird_statement.c @@ -349,11 +349,11 @@ static int pdo_firebird_stmt_get_column_meta(pdo_stmt_t *stmt, zend_long colno, #endif param_type = PDO_PARAM_INT; break; -#ifdef SQL_BOOLEAN + case SQL_BOOLEAN: param_type = PDO_PARAM_BOOL; break; -#endif + default: param_type = PDO_PARAM_STR; break; @@ -542,11 +542,9 @@ static int pdo_firebird_stmt_get_col( /* TODO: Why is this not returned as the native type? */ ZVAL_STR(result, zend_strpprintf_unchecked(0, "%.16H", php_get_double_from_sqldata(var->sqldata))); break; -#ifdef SQL_BOOLEAN case SQL_BOOLEAN: ZVAL_BOOL(result, *(FB_BOOLEAN*)var->sqldata); break; -#endif case SQL_TYPE_DATE: isc_decode_sql_date((ISC_DATE*)var->sqldata, &t); fmt = S->H->date_format ? S->H->date_format : PDO_FB_DEF_DATE_FMT; @@ -744,7 +742,6 @@ static int pdo_firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param } } -#ifdef SQL_BOOLEAN /* keep native BOOLEAN type */ if ((var->sqltype & ~1) == SQL_BOOLEAN) { switch (Z_TYPE_P(parameter)) { @@ -797,8 +794,6 @@ static int pdo_firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param } break; } -#endif - /* check if a NULL should be inserted */ switch (Z_TYPE_P(parameter)) { @@ -829,6 +824,13 @@ static int pdo_firebird_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param case SQL_TIMESTAMP: case SQL_TYPE_DATE: case SQL_TYPE_TIME: +#if FB_API_VER >= 40 + case SQL_INT128: + case SQL_DEC16: + case SQL_DEC34: + case SQL_TIMESTAMP_TZ: + case SQL_TIME_TZ: +#endif force_null = (Z_STRLEN_P(parameter) == 0); } if (!force_null) {