List:Commits« Previous MessageNext Message »
From:ahristov Date:April 27 2007 8:15pm
Subject:PHP mysqlnd svn commit: r357 - in branches/qcache: php5/ext/mysqli php6/ext/mysqli
View as plain text  
Author: ahristov
Date: 2007-04-27 22:15:15 +0200 (Fri, 27 Apr 2007)
New Revision: 357

Modified:
   branches/qcache/php5/ext/mysqli/mysqli.c
   branches/qcache/php5/ext/mysqli/mysqli_api.c
   branches/qcache/php5/ext/mysqli/mysqli_nonapi.c
   branches/qcache/php5/ext/mysqli/php_mysqli.h
   branches/qcache/php6/ext/mysqli/mysqli.c
   branches/qcache/php6/ext/mysqli/mysqli_api.c
   branches/qcache/php6/ext/mysqli/mysqli_nonapi.c
   branches/qcache/php6/ext/mysqli/php_mysqli.h
Log:
Manual merge from trunk


Modified: branches/qcache/php5/ext/mysqli/mysqli.c
===================================================================
--- branches/qcache/php5/ext/mysqli/mysqli.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php5/ext/mysqli/mysqli.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -52,6 +52,11 @@
 zend_class_entry *mysqli_warning_class_entry;
 zend_class_entry *mysqli_exception_class_entry;
 
+#ifdef HAVE_MYSQLND
+MYSQLND_ZVAL_PCACHE *mysqlnd_zval_cache;
+MYSQLND_QCACHE		*mysqlnd_qcache;
+#endif
+
 extern void php_mysqli_connect(INTERNAL_FUNCTION_PARAMETERS);
 
 typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC);
@@ -496,7 +501,7 @@
 	STD_PHP_INI_ENTRY("mysqli.default_socket",			NULL,	PHP_INI_ALL,		OnUpdateStringUnempty,	default_socket,	zend_mysqli_globals,		mysqli_globals)
 	STD_PHP_INI_BOOLEAN("mysqli.reconnect",				"0",	PHP_INI_SYSTEM,		OnUpdateLong,		reconnect,			zend_mysqli_globals,		mysqli_globals)
 #ifdef HAVE_MYSQLND
-	STD_PHP_INI_ENTRY("mysqli.cache_size",			   
"2000",	PHP_INI_SYSTEM,		OnUpdateLong,		cache_size,			zend_mysqli_globals,		mysqli_globals)
+	STD_PHP_INI_ENTRY("mysqli.cache_size",				"2000",	PHP_INI_SYSTEM,		OnUpdateLong,		cache_size,			zend_mysqli_globals,		mysqli_globals)
 #endif
 PHP_INI_END()
 
@@ -521,6 +526,13 @@
 #else
 	mysqli_globals->embedded = 0;
 #endif
+#ifdef HAVE_MYSQLND
+	mysqli_globals->cache_size = 0;
+#endif
+#ifdef HAVE_MYSQLND
+	mysqlnd_zval_cache = NULL;
+	mysqlnd_qcache = NULL;
+#endif
 }
 /* }}} */
 
@@ -535,7 +547,7 @@
 
 #ifdef HAVE_MYSQLND
 	mysqlnd_library_init();
-	MyG(mysqlnd_zval_cache) = mysqlnd_palloc_init_cache(MyG(cache_size));
+	mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MyG(cache_size));
 #endif
 
 	memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
@@ -716,7 +728,7 @@
 	zend_hash_destroy(&mysqli_link_properties);
 	zend_hash_destroy(&classes);
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_free_cache_reference(&(MyG(mysqlnd_zval_cache)));
+	mysqlnd_palloc_free_cache_reference(&mysqlnd_zval_cache);
 	mysqlnd_library_end();
 #endif
 
@@ -732,7 +744,7 @@
 	MyG(error_msg) = NULL;
 	MyG(error_no) = 0;
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_rinit(MyG(mysqlnd_zval_cache));
+	mysqlnd_palloc_rinit(mysqlnd_zval_cache);
 #endif
 
 	return SUCCESS;
@@ -747,7 +759,7 @@
 		efree(MyG(error_msg));
 	}
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_rshutdown(MyG(mysqlnd_zval_cache));
+	mysqlnd_palloc_rshutdown(mysqlnd_zval_cache);
 #endif
 	return SUCCESS;
 }
@@ -797,11 +809,11 @@
 		mysqlnd_get_client_stats(&values);
 		mysqli_minfo_print_hash(&values);
 		zval_dtor(&values);
-		php_info_print_table_header(2, "Persistent cache", MyG(mysqlnd_zval_cache)?
"enabled":"disabled");
+		php_info_print_table_header(2, "Persistent cache", mysqlnd_zval_cache?
"enabled":"disabled");
 		
-		if (MyG(mysqlnd_zval_cache)) {
+		if (mysqlnd_zval_cache) {
 			/* Now report cache status */
-			mysqlnd_palloc_stats(MyG(mysqlnd_zval_cache), &values);
+			mysqlnd_palloc_stats(mysqlnd_zval_cache, &values);
 			mysqli_minfo_print_hash(&values);
 			zval_dtor(&values);
 		}

Modified: branches/qcache/php5/ext/mysqli/mysqli_api.c
===================================================================
--- branches/qcache/php5/ext/mysqli/mysqli_api.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php5/ext/mysqli/mysqli_api.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -1633,7 +1633,7 @@
 	if (mysql_real_connect(mysql->mysql, hostname, username, passwd, dbname ,port, socket
,flags) == NULL) 
 #else
 	if (mysqlnd_connect(mysql->mysql, hostname, username, passwd, passwd_len, dbname,
dbname_len,
-						  port, socket, flags, MyG(mysqlnd_zval_cache) TSRMLS_CC) == NULL)
+						  port, socket, flags, mysqlnd_zval_cache TSRMLS_CC) == NULL)
 #endif
 	{
 		php_mysqli_set_error(mysql_errno(mysql->mysql), (char *)
mysql_error(mysql->mysql) TSRMLS_CC);

Modified: branches/qcache/php5/ext/mysqli/mysqli_nonapi.c
===================================================================
--- branches/qcache/php5/ext/mysqli/mysqli_nonapi.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php5/ext/mysqli/mysqli_nonapi.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -143,7 +143,7 @@
 	if (mysql_real_connect(mysql->mysql, hostname, username, passwd, dbname, port,
socket, CLIENT_MULTI_RESULTS) == NULL)
 #else
 	if (mysqlnd_connect(mysql->mysql, hostname, username, passwd, passwd_len, dbname,
dbname_len,
-						  port, socket, CLIENT_MULTI_RESULTS, MyG(mysqlnd_zval_cache) TSRMLS_CC) == NULL)
+						  port, socket, CLIENT_MULTI_RESULTS, mysqlnd_zval_cache TSRMLS_CC) == NULL)
 #endif
 	{
 		/* Save error messages */

Modified: branches/qcache/php5/ext/mysqli/php_mysqli.h
===================================================================
--- branches/qcache/php5/ext/mysqli/php_mysqli.h	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php5/ext/mysqli/php_mysqli.h	2007-04-27 20:15:15 UTC (rev 357)
@@ -164,6 +164,11 @@
 extern mysqli_property_entry mysqli_driver_property_entries[];
 extern mysqli_property_entry mysqli_warning_property_entries[];
 
+#ifdef HAVE_MYSQLND
+extern MYSQLND_ZVAL_PCACHE	*mysqlnd_zval_cache;
+extern MYSQLND_QCACHE		*mysqlnd_qcache;
+#endif
+
 extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flag,
int into_object);
 extern void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC);
 extern void php_clear_mysql(MY_MYSQL *);
@@ -463,10 +468,6 @@
 	HashTable		*report_ht;
 	unsigned int	multi_query;
 	unsigned int	embedded;
-#ifdef HAVE_MYSQLND
-	MYSQLND_ZVAL_PCACHE *mysqlnd_zval_cache;
-	MYSQLND_QCACHE		*mysqlnd_qcache;
-#endif
 ZEND_END_MODULE_GLOBALS(mysqli)
 
 

Modified: branches/qcache/php6/ext/mysqli/mysqli.c
===================================================================
--- branches/qcache/php6/ext/mysqli/mysqli.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php6/ext/mysqli/mysqli.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -54,6 +54,11 @@
 zend_class_entry *mysqli_warning_class_entry;
 zend_class_entry *mysqli_exception_class_entry;
 
+#ifdef HAVE_MYSQLND
+MYSQLND_ZVAL_PCACHE *mysqlnd_zval_cache;
+MYSQLND_QCACHE		*mysqlnd_qcache;
+#endif
+
 extern void php_mysqli_connect(INTERNAL_FUNCTION_PARAMETERS);
 
 typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC);
@@ -505,7 +510,7 @@
 	STD_PHP_INI_ENTRY("mysqli.default_socket",			NULL,	PHP_INI_ALL,		OnUpdateStringUnempty,	default_socket,	zend_mysqli_globals,		mysqli_globals)
 	STD_PHP_INI_BOOLEAN("mysqli.reconnect",				"0",	PHP_INI_SYSTEM,		OnUpdateLong,		reconnect,			zend_mysqli_globals,		mysqli_globals)
 #ifdef HAVE_MYSQLND
-	STD_PHP_INI_ENTRY("mysqli.cache_size",			   
"2000",	PHP_INI_SYSTEM,		OnUpdateLong,		cache_size,			zend_mysqli_globals,		mysqli_globals)
+	STD_PHP_INI_ENTRY("mysqli.cache_size",				"2000",	PHP_INI_SYSTEM,		OnUpdateLong,		cache_size,			zend_mysqli_globals,		mysqli_globals)
 	STD_PHP_INI_BOOLEAN("mysqli.qc_hash_buffer_size",	"4096",	PHP_INI_SYSTEM,		OnUpdateLong,		qc_hash_buffer_size,zend_mysqli_globals,		mysqli_globals)
 	STD_PHP_INI_BOOLEAN("mysqli.qc_ttl",				"30",	PHP_INI_SYSTEM,		OnUpdateLong,		qc_TTL,				zend_mysqli_globals,		mysqli_globals)
 #endif
@@ -514,7 +519,6 @@
 
 /* }}} */
 
-#define MYSQLI_ZVAL_CACHE_SIZE 500
 
 /* {{{ PHP_GINIT_FUNCTION
  */
@@ -535,6 +539,13 @@
 #else
 	mysqli_globals->embedded = 0;
 #endif
+#ifdef HAVE_MYSQLND
+	mysqli_globals->cache_size = 0;
+	mysqli_globals->qc_TTL = 0;
+	mysqli_globals->qc_hash_buffer_size = 0;
+	mysqlnd_zval_cache = NULL;
+	mysqlnd_qcache = NULL;
+#endif
 }
 /* }}} */
 
@@ -549,8 +560,8 @@
 
 #ifdef HAVE_MYSQLND
 	mysqlnd_library_init();
-	MyG(mysqlnd_zval_cache) = mysqlnd_palloc_init_cache(MyG(cache_size));
-	MyG(mysqlnd_qcache) = mysqlnd_qcache_init_cache(MyG(qc_TTL), MyG(qc_hash_buffer_size));
+	mysqlnd_zval_cache = mysqlnd_palloc_init_cache(MyG(cache_size));
+	mysqlnd_qcache = mysqlnd_qcache_init_cache(MyG(qc_TTL), MyG(qc_hash_buffer_size));
 #endif
 
 	memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(),
sizeof(zend_object_handlers));
@@ -736,8 +747,8 @@
 	zend_hash_destroy(&mysqli_link_properties);
 	zend_hash_destroy(&classes);
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_free_cache_reference(&(MyG(mysqlnd_zval_cache)));
-	mysqlnd_qcache_free_cache_reference(&(MyG(mysqlnd_qcache)));
+	mysqlnd_palloc_free_cache_reference(&mysqlnd_zval_cache);
+	mysqlnd_qcache_free_cache_reference(&mysqlnd_qcache);
 	mysqlnd_library_end();
 #endif
 	UNREGISTER_INI_ENTRIES();
@@ -752,7 +763,7 @@
 	MyG(error_msg) = NULL;
 	MyG(error_no) = 0;
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_rinit(MyG(mysqlnd_zval_cache));
+	mysqlnd_palloc_rinit(mysqlnd_zval_cache);
 #endif
 
 	return SUCCESS;
@@ -767,7 +778,7 @@
 		efree(MyG(error_msg));
 	}
 #ifdef HAVE_MYSQLND
-	mysqlnd_palloc_rshutdown(MyG(mysqlnd_zval_cache));
+	mysqlnd_palloc_rshutdown(mysqlnd_zval_cache);
 #endif
 	return SUCCESS;
 }
@@ -826,11 +837,11 @@
 		mysqlnd_get_client_stats(&values);
 		mysqli_minfo_print_hash(&values);
 		zval_dtor(&values);
-		php_info_print_table_header(2, "Persistent cache", MyG(mysqlnd_zval_cache)?
"enabled":"disabled");
+		php_info_print_table_header(2, "Persistent cache", mysqlnd_zval_cache?
"enabled":"disabled");
 		
-		if (MyG(mysqlnd_zval_cache)) {
+		if (mysqlnd_zval_cache) {
 			/* Now report cache status */
-			mysqlnd_palloc_stats(MyG(mysqlnd_zval_cache), &values);
+			mysqlnd_palloc_stats(mysqlnd_zval_cache, &values);
 			mysqli_minfo_print_hash(&values);
 			zval_dtor(&values);
 		}

Modified: branches/qcache/php6/ext/mysqli/mysqli_api.c
===================================================================
--- branches/qcache/php6/ext/mysqli/mysqli_api.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php6/ext/mysqli/mysqli_api.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -1653,7 +1653,7 @@
 	if (mysql_real_connect(mysql->mysql, hostname, username, passwd, dbname ,port, socket
,flags) == NULL) 
 #else
 	if (mysqlnd_connect(mysql->mysql, hostname, username, passwd, passwd_len, dbname,
dbname_len,
-						  port, socket, flags, MyG(mysqlnd_zval_cache), MyG(mysqlnd_qcache) TSRMLS_CC) ==
NULL)
+						  port, socket, flags, mysqlnd_zval_cache, mysqlnd_qcache TSRMLS_CC) == NULL)
 #endif
 	{
 		php_mysqli_set_error(mysql_errno(mysql->mysql), (char *)
mysql_error(mysql->mysql) TSRMLS_CC);

Modified: branches/qcache/php6/ext/mysqli/mysqli_nonapi.c
===================================================================
--- branches/qcache/php6/ext/mysqli/mysqli_nonapi.c	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php6/ext/mysqli/mysqli_nonapi.c	2007-04-27 20:15:15 UTC (rev 357)
@@ -149,7 +149,7 @@
 	if (mysql_real_connect(mysql->mysql, hostname, username, passwd, dbname, port,
socket, CLIENT_MULTI_RESULTS) == NULL)
 #else
 	if (mysqlnd_connect(mysql->mysql, hostname, username, passwd, passwd_len, dbname,
dbname_len,
-						  port, socket, CLIENT_MULTI_RESULTS, MyG(mysqlnd_zval_cache), MyG(mysqlnd_qcache)
TSRMLS_CC) == NULL)
+						  port, socket, CLIENT_MULTI_RESULTS, mysqlnd_zval_cache, mysqlnd_qcache TSRMLS_CC)
== NULL)
 #endif
 	{
 		/* Save error messages */
@@ -317,7 +317,7 @@
 	if (ZEND_NUM_ARGS()) {
 		WRONG_PARAM_COUNT;
 	}
-	mysqlnd_palloc_stats(MyG(mysqlnd_zval_cache), return_value);
+	mysqlnd_palloc_stats(mysqlnd_zval_cache, return_value);
 }
 /* }}} */
 
@@ -363,7 +363,7 @@
 
 	convert_to_long_ex(&mysql_value);
 
-	RETURN_BOOL(PASS == mysqlnd_qcache_setopt(MyG(mysqlnd_qcache), mysql_option,
+	RETURN_BOOL(PASS == mysqlnd_qcache_setopt(mysqlnd_qcache, mysql_option,
 											  (char *)& Z_LVAL_P(mysql_value)));
 }   
 /* }}} */
@@ -379,7 +379,7 @@
 		return;
 	}
 
-	if (mysqlnd_qcache_getopt(MyG(mysqlnd_qcache), mysql_option, return_value) == FAIL) {
+	if (mysqlnd_qcache_getopt(mysqlnd_qcache, mysql_option, return_value) == FAIL) {
 		RETURN_NULL();
 	}
 }   

Modified: branches/qcache/php6/ext/mysqli/php_mysqli.h
===================================================================
--- branches/qcache/php6/ext/mysqli/php_mysqli.h	2007-04-27 16:40:35 UTC (rev 356)
+++ branches/qcache/php6/ext/mysqli/php_mysqli.h	2007-04-27 20:15:15 UTC (rev 357)
@@ -173,6 +173,11 @@
 extern mysqli_property_entry mysqli_driver_property_entries[];
 extern mysqli_property_entry mysqli_warning_property_entries[];
 
+#ifdef HAVE_MYSQLND
+extern MYSQLND_ZVAL_PCACHE	*mysqlnd_zval_cache;
+extern MYSQLND_QCACHE		*mysqlnd_qcache;
+#endif
+
 extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flag,
int into_object);
 extern void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC);
 extern void php_clear_mysql(MY_MYSQL *);
@@ -481,8 +486,6 @@
 	unsigned int	multi_query;
 	unsigned int	embedded;
 #ifdef HAVE_MYSQLND
-	MYSQLND_ZVAL_PCACHE *mysqlnd_zval_cache;
-	MYSQLND_QCACHE		*mysqlnd_qcache;
 	long				cache_size;
 	size_t				qc_hash_buffer_size;
 	time_t				qc_TTL;

Thread
PHP mysqlnd svn commit: r357 - in branches/qcache: php5/ext/mysqli php6/ext/mysqliahristov27 Apr