|
|||||||||||
|
PHP mysqlnd svn commit: r543 - in trunk: php5/ext/mysql php6/ext/mysql
From: <ahristov(at)mysql.com>
Date: Wed Jun 27 2007 - 13:53:38 EDT
Modified: trunk/php5/ext/mysql/INSTALL trunk/php5/ext/mysql/mysql_mysqlnd.h trunk/php5/ext/mysql/php_mysql.c trunk/php5/ext/mysql/php_mysql.h trunk/php6/ext/mysql/INSTALL trunk/php6/ext/mysql/php_mysql.c Log: Sync php5/ext/mysql with php6/ext/mysql Modified: trunk/php5/ext/mysql/INSTALL
-me@myhost:~/php5> ./configure --with-mysql --enable-mysqlnd +me@myhost:~/php5> ./configure --with-mysql=mysqlnd Note that you must not specify the path to the MySQL utility mysql_config. Modified: trunk/php5/ext/mysql/mysql_mysqlnd.h
Modified: trunk/php5/ext/mysql/php_mysql.c
#include "php_ini.h"
/* True globals, no need for thread safety */
@@ -129,7 +128,6 @@
-
PHP_DEP_FE(mysql_list_tables, NULL) PHP_FE(mysql_list_fields, NULL) PHP_FE(mysql_list_processes, NULL) - PHP_FE(mysql_escape_string, NULL) - PHP_FE(mysql_result, NULL) #ifdef HAVE_MYSQL_ERRNO @@ -160,6 +156,9 @@ #endif PHP_FE(mysql_affected_rows, NULL) PHP_FE(mysql_insert_id, NULL) +#ifndef HAVE_MYSQLND + PHP_FE(mysql_result, NULL) +#endif PHP_FE(mysql_num_rows, NULL) PHP_FE(mysql_num_fields, NULL) PHP_FE(mysql_fetch_row, NULL) @@ -176,6 +175,9 @@ PHP_FE(mysql_field_len, NULL) PHP_FE(mysql_field_type, NULL) PHP_FE(mysql_field_flags, NULL) +#ifndef HAVE_MYSQLND + PHP_FE(mysql_escape_string, NULL) +#endif PHP_FE(mysql_real_escape_string, NULL) PHP_FE(mysql_stat, NULL) PHP_FE(mysql_thread_id, NULL) @@ -188,7 +190,7 @@ PHP_FE(mysql_get_server_info, NULL) #endif
/* for downwards compatability */ PHP_FALIAS(mysql, mysql_db_query, NULL) @@ -288,7 +290,7 @@ } \ } while(0); \ } \ -} +} #endif
/* {{{ _free_mysql_result
mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache();
+#ifndef HAVE_MYSQLND
+ if (mysql_server_init(0, NULL, NULL)) {
+ return FAILURE;
+ }
+#endif
+
return SUCCESS;
} /* }}} */ @@ -449,7 +457,17 @@ */ PHP_MSHUTDOWN_FUNCTION(mysql) { - UNREGISTER_INI_ENTRIES();
+#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) {
+ mysql_server_end();
+ }
+#else
+ mysql_server_end();
+#endif
+#endif
#endif + UNREGISTER_INI_ENTRIES(); return SUCCESS; } /* }}} */ @@ -465,6 +484,11 @@ */ PHP_RINIT_FUNCTION(mysql) {
+#if !defined(HAVE_MYSQLND) && defined(ZTS)
+ if (mysql_thread_init()) {
+ return FAILURE;
+ }
+#endif
MySG(default_link)=-1;
MySG(num_links) = MySG(num_persistent);
/* Reset connect error/errno on every request */
@@ -484,6 +508,12 @@
*/ PHP_RSHUTDOWN_FUNCTION(mysql) {
+#if !defined(HAVE_MYSQLND) && defined(ZTS)
+ if (mysql_thread_end()) {
+ return FAILURE;
+ }
+#endif
+
if (MySG(trace_mode)) {
if (MySG(result_allocated)){
php_error_docref("function.mysql-free-result" TSRMLS_CC, E_WARNING, "%lu result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query()", MySG(result_allocated));
@@ -602,13 +632,13 @@
if (persistent) {
client_flags= new_link;
}
- +
/* disable local infile option for open_basedir */
- if (PG(open_basedir) && strlen(PG(open_basedir)) && (client_flags & CLIENT_LOCAL_FILES)) {
- client_flags ^= CLIENT_LOCAL_FILES;
+ if (((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) && (client_flags & CLIENT_LOCAL_FILES)) {
+ client_flags ^= CLIENT_LOCAL_FILES;
}
- hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd));
+ hashed_details_length = spprintf(&hashed_details, 0, "mysql_%s_%s_%s_%d", SAFE_STRING(host_and_port), SAFE_STRING(user), SAFE_STRING(passwd), client_flags);
}
/* We cannot use mysql_port anymore in windows, need to use
@@ -646,12 +676,12 @@
if (zend_hash_find(&EG(persistent_list), hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { /* we don't */
zend_rsrc_list_entry new_le;
- if (MySG(max_links)!=-1 && MySG(num_links)>=MySG(max_links)) {
+ if (MySG(max_links) != -1 && MySG(num_links) >= MySG(max_links)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", MySG(num_links));
efree(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
}
- if (MySG(max_persistent)!=-1 && MySG(num_persistent)>=MySG(max_persistent)) {
+ if (MySG(max_persistent) != -1 && MySG(num_persistent) >= MySG(max_persistent)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)", MySG(num_persistent));
efree(hashed_details);
MYSQL_DO_CONNECT_RETURN_FALSE();
@@ -671,15 +701,17 @@
if (mysql_real_connect(mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
@@ -759,7 +791,6 @@ mysql = (php_mysql_conn *) emalloc(sizeof(php_mysql_conn)); mysql->active_result_id = 0; - #ifndef HAVE_MYSQLND
mysql->conn = mysql_init(NULL);
if (mysql_real_connect(&mysql->conn, host, user, passwd, NULL, port, socket, client_flags)==NULL)
- if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, - port, socket, client_flags, MySG(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL) + if (mysqlnd_connect(mysql->conn, host, user, passwd, 0, NULL, 0, + port, socket, client_flags, MySG(mysqlnd_thd_zval_cache) TSRMLS_CC) == NULL) @@ -1093,12 +1126,10 @@ PHPMY_UNBUFFERED_QUERY_CHECK();
- if ((stat = (char *)mysql_stat(mysql->conn)))
- {
+ if ((stat = (char *)mysql_stat(mysql->conn))) {
RETURN_STRING(stat, 1);
-#endif
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) {
return;
@@ -1128,12 +1156,7 @@
}
ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id, "MySQL-Link", le_link, le_plink);
-#ifndef HAVE_MYSQLND
RETURN_STRING((char *)mysql_character_set_name(mysql->conn), 1);
-#else
- cs = mysql->conn->charset;
- RETURN_STRING(cs->name, 1);
-#endif } /* }}} */ #endif @@ -1970,10 +1993,10 @@ break; } } + #ifndef HAVE_MYSQLND -
if ((result_type & MYSQL_BOTH) == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH");
}
ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL result", le_result);
@@ -2143,7 +2166,6 @@
ZEND_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, -1, "MySQL result", le_result);
mysqlnd_fetch_into(result, mode, return_value);
-
#endif } /* }}} */ Modified: trunk/php5/ext/mysql/php_mysql.h
+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || HAVE_MYSQLND +#define MYSQL_HAS_SET_CHARSET +#endif + extern zend_module_entry mysql_module_entry; #define mysql_module_ptr &mysql_module_entry PHP_FUNCTION(mysql_query); PHP_FUNCTION(mysql_unbuffered_query); PHP_FUNCTION(mysql_db_query); -#ifndef HAVE_MYSQLND PHP_FUNCTION(mysql_list_dbs); PHP_FUNCTION(mysql_list_tables); PHP_FUNCTION(mysql_list_fields); PHP_FUNCTION(mysql_list_processes); -PHP_FUNCTION(mysql_escape_string); -PHP_FUNCTION(mysql_result); -#endif PHP_FUNCTION(mysql_error); PHP_FUNCTION(mysql_errno); PHP_FUNCTION(mysql_affected_rows); PHP_FUNCTION(mysql_insert_id); +PHP_FUNCTION(mysql_result); PHP_FUNCTION(mysql_num_rows); PHP_FUNCTION(mysql_num_fields); PHP_FUNCTION(mysql_fetch_row); @@ -102,6 +103,7 @@ PHP_FUNCTION(mysql_field_len); PHP_FUNCTION(mysql_field_type); PHP_FUNCTION(mysql_field_flags); +PHP_FUNCTION(mysql_escape_string); PHP_FUNCTION(mysql_real_escape_string); PHP_FUNCTION(mysql_get_client_info); PHP_FUNCTION(mysql_get_host_info); Modified: trunk/php6/ext/mysql/INSTALL
-me@myhost:~/php6> ./configure --with-mysql --enable-mysqlnd +me@myhost:~/php6> ./configure --with-mysql=mysqlnd Note that you must not specify the path to the MySQL utility mysql_config. Modified: trunk/php6/ext/mysql/php_mysql.c
-- 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 Wed Jun 27 13:53:43 2007 This archive was generated by hypermail 2.1.8 : Wed Jun 27 2007 - 14:00:03 EDT |
||||||||||
|
|||||||||||