|
|||||||||||
|
PHP mysqlnd svn commit: r1074 - in trunk: mysqlnd php4/ext/mysql php5/ext/mysql php5/ext/mysqli php6/ext/mysql php6/ext/mysqli tests/ext/mysqli
From: <ahristov(at)mysql.com>
Date: Mon Oct 01 2007 - 11:52:23 EDT
Modified: trunk/mysqlnd/mysqlnd.c trunk/mysqlnd/mysqlnd.h trunk/mysqlnd/mysqlnd_loaddata.c trunk/mysqlnd/mysqlnd_structs.h trunk/php4/ext/mysql/php_mysql.c trunk/php5/ext/mysql/php_mysql.c trunk/php5/ext/mysqli/mysqli.c trunk/php5/ext/mysqli/mysqli_api.c trunk/php5/ext/mysqli/mysqli_fe.c trunk/php6/ext/mysql/php_mysql.c trunk/php6/ext/mysqli/mysqli.c trunk/php6/ext/mysqli/mysqli_api.c trunk/php6/ext/mysqli/mysqli_fe.c trunk/tests/ext/mysqli/mysqli_class_mysqli_interface.phpt trunk/tests/ext/mysqli/mysqli_class_mysqli_reflection.phpt trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_unregister.phptLog: Disable INFILE handler for mysqlnd. Whoever needs that functionality might write a stream wrapper and gain the same. Modified: trunk/mysqlnd/mysqlnd.c
DBG_ENTER("mysqlnd_conn::free_contents");
+ mysqlnd_local_infile_default(conn);
{
uint buf_size;
buf_size = MYSQLND_G(net_read_buffer_size); /* this is long, cast to uint*/
Modified: trunk/mysqlnd/mysqlnd.h
/* LOAD DATA LOCAL */ -PHPAPI void mysqlnd_local_infile_default(MYSQLND *conn, zend_bool free_callback); +PHPAPI void mysqlnd_local_infile_default(MYSQLND *conn); PHPAPI void mysqlnd_set_local_infile_handler(MYSQLND * const conn, const char * const funcname); /* Simple commands */ Modified: trunk/mysqlnd/mysqlnd_loaddata.c
@@ -216,6 +135,7 @@
/* php_stream_close segfaults on NULL */
if (info->fd) {
php_stream_close(info->fd);
+ info->fd = NULL;
}
mnd_efree(info);
}
@@ -224,17 +144,12 @@
/* {{{ mysqlnd_local_infile_default */
conn->infile.local_infile_init = mysqlnd_local_infile_init;
conn->infile.local_infile_read = mysqlnd_local_infile_read;
conn->infile.local_infile_error = mysqlnd_local_infile_error;
conn->infile.local_infile_end = mysqlnd_local_infile_end;
- conn->infile.userdata = NULL;
- if (free_callback == TRUE && conn->infile.callback) {
- zval_ptr_dtor(&conn->infile.callback);
- conn->infile.callback = NULL;
- }
} /* }}} */ @@ -277,12 +192,6 @@
goto infile_error;
}
- /* check if we have valid functions */
- if (!conn->infile.local_infile_init || !conn->infile.local_infile_read ||
- !conn->infile.local_infile_error || !conn->infile.local_infile_end) {
- mysqlnd_local_infile_default(conn, FALSE);
- }
-
infile = conn->infile;
/* allocate buffer for reading data */
buf = (char *)mnd_ecalloc(1, buflen);
- -
/* read data */
while ((bufsize = infile.local_infile_read (info, buf + MYSQLND_HEADER_SIZE,
buflen - MYSQLND_HEADER_SIZE TSRMLS_CC)) > 0) {
Modified: trunk/mysqlnd/mysqlnd_structs.h
/* {{{ mysql_functions[]
PHP_FE(mysql_connect, NULL) PHP_FE(mysql_pconnect, NULL) PHP_FE(mysql_close, NULL) @@ -215,7 +215,7 @@ /* }}} */
/* Dependancies */
ZEND_MOD_REQUIRED("mysqlnd")
- unsigned long client_ver = mysql_get_client_version;
- /* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
- if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
+ unsigned long client_ver = mysql_get_client_version();
+ /*
+ Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows.
+ PHP bug#41350 MySQL bug#25621
+ */
+ if ((client_ver >= 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else Modified: trunk/php5/ext/mysql/php_mysql.c
/* {{{ mysql_functions[]
PHP_FE(mysql_connect, NULL) PHP_FE(mysql_pconnect, NULL) PHP_FE(mysql_close, NULL) @@ -222,7 +222,7 @@ /* }}} */
/* Dependancies */
ZEND_MOD_REQUIRED("mysqlnd")
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
#ifndef HAVE_MYSQLND
if (mysql_server_init(0, NULL, NULL)) {
return FAILURE;
}
+#endif #else mysql_mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MySG(cache_size)); mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache(); @@ -468,9 +470,12 @@ { #ifndef HAVE_MYSQLND #ifdef PHP_WIN32
- unsigned long client_ver = mysql_get_client_version;
- /* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
- if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
+ unsigned long client_ver = mysql_get_client_version();
+ /*
+ Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows.
+ PHP bug#41350 MySQL bug#25621
+ */
+ if ((client_ver >= 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else @@ -490,7 +495,7 @@ */ PHP_RINIT_FUNCTION(mysql) {
-#if !defined(HAVE_MYSQLND) && defined(ZTS)
+#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
@@ -514,7 +519,7 @@ */ PHP_RSHUTDOWN_FUNCTION(mysql) { -#if !defined(HAVE_MYSQLND) && defined(ZTS) +#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
Modified: trunk/php5/ext/mysqli/mysqli.c
REGISTER_INI_ENTRIES();
if (mysql_server_init(0, NULL, NULL)) {
return FAILURE;
}
+#endif #else mysqli_mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MyG(cache_size)); mysqli_mysqlnd_qcache = mysqlnd_qcache_init_cache(); @@ -792,8 +794,11 @@ #ifndef HAVE_MYSQLND #ifdef PHP_WIN32
unsigned long client_ver = mysql_get_client_version();
- /* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
- if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
+ /*
+ Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows.
+ PHP bug#41350 MySQL bug#25621
+ */
+ if ((client_ver >= 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else @@ -820,7 +825,7 @@ */ PHP_RINIT_FUNCTION(mysqli) {
-#if !defined(HAVE_MYSQLND) && defined(ZTS)
+#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
-#if !defined(HAVE_MYSQLND) && defined(ZTS) +#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
if (MyG(error_msg)) {
+#if !defined(HAVE_MYSQLND)
a = (zval ***)safe_emalloc(c, sizeof(zval **), 0);\
/* register internal callback functions */ -#if !defined(HAVE_MYSQLND)
mysql_set_local_infile_handler(mysql->mysql, &php_local_infile_init, &php_local_infile_read,
&php_local_infile_end, &php_local_infile_error, (void *)mysql);
if (mysql->li_read) {
zval_ptr_dtor(&mysql->li_read);
mysql->li_read = NULL;
}
-#else
- mysqlnd_local_infile_default(mysql->mysql, TRUE);
-#endif
} /* }}} */
-#if !defined(HAVE_MYSQLND)
Modified: trunk/php5/ext/mysqli/mysqli_api.c
/* {{{ proto void mysqli_set_local_infile_default(object link)
unsets user defined handler for load local infile command */
+#if !defined(HAVE_MYSQLND)
MY_MYSQL *mysql;
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID); -#if !defined(HAVE_MYSQLND)
if (mysql->li_read) {
efree(Z_STRVAL_P(mysql->li_read));
zval_dtor(mysql->li_read);
mysql->li_read = NULL;
}
-#else
- mysqlnd_local_infile_default(mysql->mysql, TRUE);
-#endif
} /* }}} */ @@ -1371,19 +1368,16 @@ efree(callback_name);
/* save callback function */
if (!mysql->li_read) {
MAKE_STD_ZVAL(mysql->li_read);
} else {
zval_dtor(mysql->li_read);
}
ZVAL_STRINGL(mysql->li_read, Z_STRVAL_P(callback_func), Z_STRLEN_P(callback_func), 1);
-#else
- mysqlnd_set_local_infile_handler(mysql->mysql, callback_func->value.str.val);
-#endif
RETURN_TRUE;
/* {{{ proto bool mysqli_more_results(object link) Modified: trunk/php5/ext/mysqli/mysqli_fe.c
Modified: trunk/php6/ext/mysql/php_mysql.c
/* {{{ mysql_functions[]
PHP_FE(mysql_connect, NULL) PHP_FE(mysql_pconnect, NULL) PHP_FE(mysql_close, NULL) @@ -219,7 +219,7 @@ /* }}} */
/* Dependancies */
ZEND_MOD_REQUIRED("mysqlnd")
REGISTER_LONG_CONSTANT("MYSQL_CLIENT_IGNORE_SPACE", CLIENT_IGNORE_SPACE, CONST_CS | CONST_PERSISTENT);
#ifndef HAVE_MYSQLND
if (mysql_server_init(0, NULL, NULL)) {
return FAILURE;
}
+#endif #else mysql_mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MySG(cache_size)); mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache(); @@ -465,9 +467,12 @@ { #ifndef HAVE_MYSQLND #ifdef PHP_WIN32
- unsigned long client_ver = mysql_get_client_version;
- /* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
- if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
+ unsigned long client_ver = mysql_get_client_version();
+ /*
+ Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows.
+ PHP bug#41350 MySQL bug#25621
+ */
+ if ((client_ver >= 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else @@ -487,7 +492,7 @@ */ PHP_RINIT_FUNCTION(mysql) {
-#if !defined(HAVE_MYSQLND) && defined(ZTS)
+#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
@@ -511,7 +516,7 @@ */ PHP_RSHUTDOWN_FUNCTION(mysql) { -#if !defined(HAVE_MYSQLND) && defined(ZTS) +#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
Modified: trunk/php6/ext/mysqli/mysqli.c
+#if MYSQL_VERSION >= 40000
if (mysql_server_init(0, NULL, NULL)) {
return FAILURE;
}
+#endif #else mysqli_mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MyG(cache_size)); mysqli_mysqlnd_qcache = mysqlnd_qcache_init_cache(); @@ -798,8 +800,11 @@ #ifndef HAVE_MYSQLND #ifdef PHP_WIN32
unsigned long client_ver = mysql_get_client_version();
- /* Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows */
- if ((client_ver > 50042 && client_ver < 50100) || client_ver > 50122) {
+ /*
+ Can't call mysql_server_end() multiple times prior to 5.0.42 on Windows.
+ PHP bug#41350 MySQL bug#25621
+ */
+ if ((client_ver >= 50042 && client_ver < 50100) || client_ver > 50122) {
mysql_server_end();
}
#else @@ -826,7 +831,7 @@ */ PHP_RINIT_FUNCTION(mysqli) {
-#if !defined(HAVE_MYSQLND) && defined(ZTS)
+#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
if (mysql_thread_init()) {
return FAILURE;
}
-#if !defined(HAVE_MYSQLND) && defined(ZTS) +#if !defined(HAVE_MYSQLND) && defined(ZTS) && MYSQL_VERSION_ID >= 40000
mysql_thread_end();
if (MyG(error_msg)) {
+#if !defined(HAVE_MYSQLND) + + #define ALLOC_CALLBACK_ARGS(a, b, c)\ if (c) {\
a = (zval ***)safe_emalloc(c, sizeof(zval **), 0);\
+
/* register internal callback functions */ -#if !defined(HAVE_MYSQLND)
mysql_set_local_infile_handler(mysql->mysql, &php_local_infile_init, &php_local_infile_read,
&php_local_infile_end, &php_local_infile_error, (void *)mysql);
if (mysql->li_read) {
zval_ptr_dtor(&mysql->li_read);
mysql->li_read = NULL;
}
-#else
- mysqlnd_local_infile_default(mysql->mysql, TRUE);
-#endif
} /* }}} */
-#if !defined(HAVE_MYSQLND)
Modified: trunk/php6/ext/mysqli/mysqli_api.c
/* {{{ proto void mysqli_set_local_infile_default(object link) U
unsets user defined handler for load local infile command */
+#if !defined(HAVE_MYSQLND)
MY_MYSQL *mysql;
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID); -#if !defined(HAVE_MYSQLND)
if (mysql->li_read) {
- efree(Z_STRVAL_P(mysql->li_read));
zval_dtor(mysql->li_read);
mysql->li_read = NULL;
}
-#else
- mysqlnd_local_infile_default(mysql->mysql, TRUE);
-#endif
} /* }}} */ @@ -1442,19 +1438,16 @@ zval_dtor(&callback_name);
/* save callback function */
if (!mysql->li_read) {
MAKE_STD_ZVAL(mysql->li_read);
} else {
zval_dtor(mysql->li_read);
}
ZVAL_STRINGL(mysql->li_read, Z_STRVAL_P(callback_func), Z_STRLEN_P(callback_func), 1);
-#else
- mysqlnd_set_local_infile_handler(mysql->mysql, callback_func->value.str.val);
-#endif
RETURN_TRUE;
/* {{{ proto bool mysqli_more_results(object link) U Modified: trunk/php6/ext/mysqli/mysqli_fe.c
Modified: trunk/tests/ext/mysqli/mysqli_class_mysqli_interface.phpt
if (function_exists('mysqli_ssl_set'))
$expected_methods['ssl_set'] = true;
+ $expected_methods['set_local_infile_default'] = true;
+ $expected_methods['set_local_infile_handler'] = true;
}
/* we should add ruled when to expect them */
@@ -305,4 +305,4 @@ Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation): mysqli->connect_error = ''/unicode (''/unicode) mysqli->connect_errno = '0'/integer ('0'/integer) -done! \ No newline at end of file +done! Modified: trunk/tests/ext/mysqli/mysqli_class_mysqli_reflection.phpt
-Inspecting method 'set_local_infile_default' -isFinal: no -isAbstract: no -isPublic: yes -isPrivate: no -isProtected: no -isStatic: no -isConstructor: no -isDestructor: no -isInternal: yes -isUserDefined: no -returnsReference: no -Modifiers: 256 -Number of Parameters: 0 -Number of Required Parameters: 0 - -Inspecting method 'set_local_infile_handler' -isFinal: no -isAbstract: no -isPublic: yes -isPrivate: no -isProtected: no -isStatic: no -isConstructor: no -isDestructor: no -isInternal: yes -isUserDefined: no -returnsReference: no -Modifiers: 256 -Number of Parameters: 0 -Number of Required Parameters: 0 - Inspecting method 'set_opt' isFinal: no isAbstract: no @@ -678,4 +646,4 @@ Modifiers: 256 Number of Parameters: 0 Number of Required Parameters: 0 -done! \ No newline at end of file +done! Modified: trunk/tests/ext/mysqli/mysqli_set_local_infile_handler_unregister.phpt
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Mon Oct 1 11:52:28 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:47:17 EDT |
||||||||||
|
|||||||||||