mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
MFH:
Warning if the library API version differs from the headers used to compile. Patch versions are not considered but major.minor Fix build of ext/mysql with 4.0.x and pre.
This commit is contained in:
parent
c0611c10ef
commit
4df718a477
2 changed files with 34 additions and 1 deletions
|
@ -130,10 +130,14 @@ static MYSQLND_ZVAL_PCACHE *mysql_mysqlnd_zval_cache;
|
|||
static MYSQLND_QCACHE *mysql_mysqlnd_qcache;
|
||||
#endif
|
||||
|
||||
#if MYSQL_VERSION_ID >= 40101
|
||||
#define MYSQL_DISABLE_MQ if (mysql->multi_query) { \
|
||||
mysql_set_server_option(mysql->conn, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \
|
||||
mysql->multi_query = 0; \
|
||||
}
|
||||
#else
|
||||
#define MYSQL_DISABLE_MQ
|
||||
#endif
|
||||
|
||||
/* {{{ mysql_functions[]
|
||||
*/
|
||||
|
@ -632,6 +636,13 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
zend_bool free_host=0, new_link=0;
|
||||
long connect_timeout;
|
||||
|
||||
#if !defined(MYSQL_USE_MYSQLND)
|
||||
if ((MYSQL_VERSION_ID / 100) != (mysql_get_client_version() / 100)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,
|
||||
"Headers and client library minor version mismatch. Headers:%d Library:%d",
|
||||
MYSQL_VERSION_ID, mysql_get_client_version());
|
||||
}
|
||||
#endif
|
||||
|
||||
connect_timeout = MySG(connect_timeout);
|
||||
|
||||
|
@ -693,8 +704,9 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
client_flags ^= CLIENT_LOCAL_FILES;
|
||||
}
|
||||
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
client_flags &= ~CLIENT_MULTI_STATEMENTS; /* don't allow multi_queries via connect parameter */
|
||||
|
||||
#endif
|
||||
hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%ld", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
|
||||
}
|
||||
|
||||
|
@ -746,7 +758,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
/* create the link */
|
||||
mysql = (php_mysql_conn *) malloc(sizeof(php_mysql_conn));
|
||||
mysql->active_result_id = 0;
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
mysql->multi_query = client_flags & CLIENT_MULTI_STATEMENTS? 1:0;
|
||||
#else
|
||||
mysql->multi_query = 0;
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_USE_MYSQLND
|
||||
mysql->conn = mysql_init(NULL);
|
||||
#else
|
||||
|
@ -794,7 +811,11 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
}
|
||||
mysql = (php_mysql_conn *) le->ptr;
|
||||
mysql->active_result_id = 0;
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
mysql->multi_query = client_flags & CLIENT_MULTI_STATEMENTS? 1:0;
|
||||
#else
|
||||
mysql->multi_query = 0;
|
||||
#endif
|
||||
/* ensure that the link did not die */
|
||||
#if defined(MYSQL_USE_MYSQLND)
|
||||
mysqlnd_end_psession(mysql->conn);
|
||||
|
@ -860,7 +881,10 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
|
|||
|
||||
mysql = (php_mysql_conn *) emalloc(sizeof(php_mysql_conn));
|
||||
mysql->active_result_id = 0;
|
||||
#ifdef CLIENT_MULTI_STATEMENTS
|
||||
mysql->multi_query = 1;
|
||||
#endif
|
||||
|
||||
#ifndef MYSQL_USE_MYSQLND
|
||||
mysql->conn = mysql_init(NULL);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue