From 53ccce5ccbf7183898fa5c1749871a2d4ecbabef Mon Sep 17 00:00:00 2001 From: MARiA so cute <33935209+NathanFreeman@users.noreply.github.com> Date: Mon, 16 Oct 2023 08:34:57 +0800 Subject: [PATCH] Fix bug #5161 (#5165) * Fix odbc constant * Fix bug #5161 --- ext-src/swoole_odbc.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext-src/swoole_odbc.cc b/ext-src/swoole_odbc.cc index 211f6726076..cdeacad023a 100644 --- a/ext-src/swoole_odbc.cc +++ b/ext-src/swoole_odbc.cc @@ -202,7 +202,7 @@ SQLRETURN SQL_API swoole_odbc_SQLDisconnect(SQLHDBC ConnectionHandle) { } int php_swoole_odbc_minit(int module_id) { - if (zend_hash_str_find(&php_pdo_get_dbh_ce()->constants_table, ZEND_STRL("PGSQL_ATTR_DISABLE_PREPARES")) == + if (zend_hash_str_find(&php_pdo_get_dbh_ce()->constants_table, ZEND_STRL("ODBC_ATTR_USE_CURSOR_LIBRARY")) == nullptr) { #ifdef SQL_ATTR_CONNECTION_POOLING char *pooling_val = NULL; @@ -244,6 +244,8 @@ int php_swoole_odbc_minit(int module_id) { REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_DRIVER", SQL_CUR_USE_DRIVER); REGISTER_PDO_CLASS_CONST_LONG("ODBC_SQL_USE_ODBC", SQL_CUR_USE_ODBC); } + + php_pdo_unregister_driver(&swoole_pdo_odbc_driver); php_pdo_register_driver(&swoole_pdo_odbc_driver); return SUCCESS;