andrey Wed, 09 Dec 2009 20:38:11 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291932
Log: Remove stub code which never actually was used for anything. Things like this can be built on top of the core. Changed paths: U php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c U php/php-src/branches/PHP_5_3/ext/mysql/php_mysql_structs.h U php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c U php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h U php/php-src/branches/PHP_5_3/ext/mysqlnd/config.w32 U php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h D php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_qcache.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h U php/php-src/trunk/ext/mysql/php_mysql.c U php/php-src/trunk/ext/mysql/php_mysql_structs.h U php/php-src/trunk/ext/mysqli/mysqli.c U php/php-src/trunk/ext/mysqli/php_mysqli_structs.h U php/php-src/trunk/ext/mysqlnd/config.w32 U php/php-src/trunk/ext/mysqlnd/config9.m4 U php/php-src/trunk/ext/mysqlnd/mysqlnd.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.h D php/php-src/trunk/ext/mysqlnd/mysqlnd_qcache.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h
Modified: php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysql/php_mysql.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -125,9 +125,6 @@ int multi_query; } php_mysql_conn; -#ifdef MYSQL_USE_MYSQLND -static MYSQLND_QCACHE *mysql_mysqlnd_qcache; -#endif #if MYSQL_VERSION_ID >= 40101 #define MYSQL_DISABLE_MQ if (mysql->multi_query) { \ @@ -457,8 +454,6 @@ return FAILURE; } #endif -#else - mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif return SUCCESS; @@ -484,8 +479,6 @@ mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysql_mysqlnd_qcache); #endif UNREGISTER_INI_ENTRIES(); Modified: php/php-src/branches/PHP_5_3/ext/mysql/php_mysql_structs.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysql/php_mysql_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysql/php_mysql_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -124,9 +124,6 @@ long result_allocated; long trace_mode; long allow_local_infile; -#ifdef MYSQL_USE_MYSQLND - MYSQLND_QCACHE *mysqlnd_qcache; -#endif ZEND_END_MODULE_GLOBALS(mysql) #ifdef ZTS Modified: php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqli/mysqli.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -73,11 +73,7 @@ zend_class_entry *mysqli_warning_class_entry; zend_class_entry *mysqli_exception_class_entry; -#ifdef MYSQLI_USE_MYSQLND -MYSQLND_QCACHE *mysqli_mysqlnd_qcache; -#endif - typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC); typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval TSRMLS_DC); @@ -633,8 +629,6 @@ return FAILURE; } #endif -#else - mysqli_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -872,8 +866,6 @@ mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysqli_mysqlnd_qcache); #endif zend_hash_destroy(&mysqli_driver_properties); Modified: php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqli/php_mysqli_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -196,10 +196,6 @@ extern zend_property_info mysqli_driver_property_info_entries[]; extern zend_property_info mysqli_warning_property_info_entries[]; -#ifdef MYSQLI_USE_MYSQLND -extern MYSQLND_QCACHE *mysqli_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 *); Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config.w32 =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/config.w32 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config.w32 2009-12-09 20:38:11 UTC (rev 291932) @@ -13,7 +13,6 @@ "mysqlnd_loaddata.c " + "mysqlnd_ps.c " + "mysqlnd_ps_codec.c " + - "mysqlnd_qcache.c " + "mysqlnd_result.c " + "mysqlnd_result_meta.c " + "mysqlnd_statistics.c " + Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/config9.m4 2009-12-09 20:38:11 UTC (rev 291932) @@ -16,7 +16,7 @@ if test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_sources="mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ mysqlnd_ps.c mysqlnd_loaddata.c \ - mysqlnd_ps_codec.c mysqlnd_statistics.c mysqlnd_qcache.c\ + mysqlnd_ps_codec.c mysqlnd_statistics.c \ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\ mysqlnd_block_alloc.c php_mysqlnd.c" Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -211,11 +211,6 @@ mnd_pefree(conn->last_message, pers); conn->last_message = NULL; } - if (conn->qcache) { - DBG_INF("Freeing qcache reference"); - mysqlnd_qcache_free_cache_reference(&conn->qcache); - conn->qcache = NULL; - } if (conn->net.cmd_buffer.buffer) { DBG_INF("Freeing cmd buffer"); mnd_pefree(conn->net.cmd_buffer.buffer, pers); Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -306,34 +306,6 @@ /* Performance statistics */ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); - -/* ---------------------- QUERY CACHE ---------------*/ -struct st_mysqlnd_qcache { - HashTable *ht; - unsigned int references; -#ifdef ZTS - MUTEX_T LOCK_access; -#endif -}; - - -typedef struct st_mysqlnd_qcache_element { - MYSQLND_RES_BUFFERED *data; - MYSQLND_RES_METADATA *meta; - const char * query; - size_t query_len; -} MYSQLND_QCACHE_ELEMENT; - - -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache(); -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache); -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache); -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value); -MYSQLND_RES * mysqlnd_qcache_get(MYSQLND_QCACHE * const cache, const char * query, - size_t query_len); -void mysqlnd_qcache_put(MYSQLND_QCACHE * const cache, char * query, size_t query_len, - MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta); - /* double check the class name to avoid naming conflicts when using these: */ #define MYSQLND_METHOD(class, method) php_##class##_##method##_pub #define MYSQLND_METHOD_PRIVATE(class, method) php_##class##_##method##_priv Deleted: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_qcache.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_qcache.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_qcache.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -1,141 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 6 | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2009 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | lice...@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Georg Richter <ge...@mysql.com> | - | Andrey Hristov <and...@mysql.com> | - | Ulf Wendel <uwen...@mysql.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ -#include "php.h" -#include "mysqlnd.h" -#include "mysqlnd_priv.h" -#include "mysqlnd_statistics.h" - -#define MYSQLND_SILENT - -#ifdef ZTS -#define LOCK_QCACHE(cache) tsrm_mutex_lock((cache)->LOCK_access) -#define UNLOCK_QCACHE(cache) tsrm_mutex_unlock((cache)->LOCK_access) -#else -#define LOCK_QCACHE(cache) -#define UNLOCK_QCACHE(cache) -#endif - - -/* {{{ mysqlnd_qcache_init_cache */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache() -{ - MYSQLND_QCACHE *cache = calloc(1, sizeof(MYSQLND_QCACHE)); -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_init_cache %p]\n", cache); -#endif - - cache->references = 1; -#ifdef ZTS - cache->LOCK_access = tsrm_mutex_alloc(); -#endif - cache->ht = malloc(sizeof(HashTable)); - zend_hash_init(cache->ht, 10 /* init_elements */, NULL, NULL, TRUE /*pers*/); - - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_get_cache_reference */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache) -{ - if (cache) { -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_get_cache_reference %p will become %d]\n", cache, cache->references+1); -#endif - LOCK_QCACHE(cache); - cache->references++; - UNLOCK_QCACHE(cache); - } - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache */ -/* - As this call will happen on MSHUTDOWN(), then we don't need to copy the zvals with - copy_ctor but scrap what they point to with zval_dtor() and then just free our - pre-allocated block. Precondition is that we ZVAL_NULL() the zvals when we put them - to the free list after usage. We ZVAL_NULL() them when we allocate them in the - constructor of the cache. -*/ -static -void mysqlnd_qcache_free_cache(MYSQLND_QCACHE *cache) -{ -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache %p]\n", cache); -#endif - -#ifdef ZTS - tsrm_mutex_free(cache->LOCK_access); -#endif - zend_hash_destroy(cache->ht); - free(cache->ht); - free(cache); -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache) -{ - if (*cache) { - zend_bool to_free; -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache_reference %p] refs=%d\n", *cache, (*cache)->references); -#endif - LOCK_QCACHE(*cache); - to_free = --(*cache)->references == 0; - /* Unlock before destroying */ - UNLOCK_QCACHE(*cache); - if (to_free) { - mysqlnd_qcache_free_cache(*cache); - } - *cache = NULL; - } -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value) -{ - if (cache) { - LOCK_QCACHE(cache); - array_init(return_value); - add_assoc_long_ex(return_value, "references", sizeof("references"), cache->references); - UNLOCK_QCACHE(cache); - } else { - ZVAL_NULL(return_value); - } -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -223,9 +223,6 @@ } set->data_cursor = NULL; set->row_count = 0; - if (set->qcache) { - mysqlnd_qcache_free_cache_reference(&set->qcache); - } DBG_INF("Freeing set"); mnd_pefree(set, set->persistent); @@ -1069,7 +1066,6 @@ set->row_buffers = mnd_pemalloc(free_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *), to_cache); } set->persistent = to_cache; - set->qcache = to_cache? mysqlnd_qcache_get_cache_reference(conn->qcache):NULL; set->references = 1; result->m.row_decoder = binary_protocol? php_mysqlnd_rowp_read_binary_protocol: Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -107,9 +107,6 @@ } mysqlnd_error_info; -typedef struct st_mysqlnd_qcache MYSQLND_QCACHE; - - typedef struct st_mysqlnd_infile_info { php_stream *fd; @@ -480,9 +477,6 @@ /* options */ MYSQLND_OPTION options; - /* qcache */ - MYSQLND_QCACHE *qcache; - /* stats */ MYSQLND_STATS stats; @@ -526,7 +520,6 @@ uint64_t initialized_rows; zend_bool persistent; - MYSQLND_QCACHE *qcache; unsigned int references; mysqlnd_error_info error_info; Modified: php/php-src/trunk/ext/mysql/php_mysql.c =================================================================== --- php/php-src/trunk/ext/mysql/php_mysql.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysql/php_mysql.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -118,11 +118,7 @@ int multi_query; } php_mysql_conn; -#ifdef MYSQL_USE_MYSQLND -static MYSQLND_QCACHE *mysql_mysqlnd_qcache; -#endif - #ifdef CLIENT_MULTI_STATEMENTS #define MYSQL_DISABLE_MQ if (mysql->multi_query) { \ mysql_set_server_option(mysql->conn, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \ @@ -452,8 +448,6 @@ return FAILURE; } #endif -#else - mysql_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif return SUCCESS; @@ -479,8 +473,6 @@ mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysql_mysqlnd_qcache); #endif UNREGISTER_INI_ENTRIES(); Modified: php/php-src/trunk/ext/mysql/php_mysql_structs.h =================================================================== --- php/php-src/trunk/ext/mysql/php_mysql_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysql/php_mysql_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -127,9 +127,6 @@ long result_allocated; long trace_mode; long allow_local_infile; -#ifdef MYSQL_USE_MYSQLND - MYSQLND_QCACHE *mysqlnd_qcache; -#endif ZEND_END_MODULE_GLOBALS(mysql) #ifdef ZTS Modified: php/php-src/trunk/ext/mysqli/mysqli.c =================================================================== --- php/php-src/trunk/ext/mysqli/mysqli.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqli/mysqli.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -73,11 +73,7 @@ zend_class_entry *mysqli_warning_class_entry; zend_class_entry *mysqli_exception_class_entry; -#ifdef MYSQLI_USE_MYSQLND -MYSQLND_QCACHE *mysqli_mysqlnd_qcache; -#endif - typedef int (*mysqli_read_t)(mysqli_object *obj, zval **retval TSRMLS_DC); typedef int (*mysqli_write_t)(mysqli_object *obj, zval *newval TSRMLS_DC); @@ -639,8 +635,6 @@ return FAILURE; } #endif -#else - mysqli_mysqlnd_qcache = mysqlnd_qcache_init_cache(); #endif memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); @@ -878,8 +872,6 @@ mysql_server_end(); #endif #endif -#else - mysqlnd_qcache_free_cache_reference(&mysqli_mysqlnd_qcache); #endif zend_hash_destroy(&mysqli_driver_properties); Modified: php/php-src/trunk/ext/mysqli/php_mysqli_structs.h =================================================================== --- php/php-src/trunk/ext/mysqli/php_mysqli_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqli/php_mysqli_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -207,10 +207,6 @@ extern zend_property_info mysqli_driver_property_info_entries[]; extern zend_property_info mysqli_warning_property_info_entries[]; -#ifdef MYSQLI_USE_MYSQLND -extern MYSQLND_QCACHE *mysqli_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 *); Modified: php/php-src/trunk/ext/mysqlnd/config.w32 =================================================================== --- php/php-src/trunk/ext/mysqlnd/config.w32 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/config.w32 2009-12-09 20:38:11 UTC (rev 291932) @@ -13,7 +13,6 @@ "mysqlnd_loaddata.c " + "mysqlnd_ps.c " + "mysqlnd_ps_codec.c " + - "mysqlnd_qcache.c " + "mysqlnd_result.c " + "mysqlnd_result_meta.c " + "mysqlnd_statistics.c " + Modified: php/php-src/trunk/ext/mysqlnd/config9.m4 =================================================================== --- php/php-src/trunk/ext/mysqlnd/config9.m4 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/config9.m4 2009-12-09 20:38:11 UTC (rev 291932) @@ -16,7 +16,7 @@ if test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_sources="mysqlnd.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ mysqlnd_ps.c mysqlnd_loaddata.c \ - mysqlnd_ps_codec.c mysqlnd_statistics.c mysqlnd_qcache.c\ + mysqlnd_ps_codec.c mysqlnd_statistics.c \ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\ mysqlnd_block_alloc.c php_mysqlnd.c" Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -211,11 +211,6 @@ mnd_pefree(conn->last_message, pers); conn->last_message = NULL; } - if (conn->qcache) { - DBG_INF("Freeing qcache reference"); - mysqlnd_qcache_free_cache_reference(&conn->qcache); - conn->qcache = NULL; - } if (conn->net.cmd_buffer.buffer) { DBG_INF("Freeing cmd buffer"); mnd_pefree(conn->net.cmd_buffer.buffer, pers); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -306,34 +306,6 @@ /* Performance statistics */ PHPAPI void _mysqlnd_get_client_stats(zval *return_value TSRMLS_DC ZEND_FILE_LINE_DC); - -/* ---------------------- QUERY CACHE ---------------*/ -struct st_mysqlnd_qcache { - HashTable *ht; - unsigned int references; -#ifdef ZTS - MUTEX_T LOCK_access; -#endif -}; - - -typedef struct st_mysqlnd_qcache_element { - MYSQLND_RES_BUFFERED *data; - MYSQLND_RES_METADATA *meta; - const char * query; - size_t query_len; -} MYSQLND_QCACHE_ELEMENT; - - -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache(); -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache); -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache); -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value); -MYSQLND_RES * mysqlnd_qcache_get(MYSQLND_QCACHE * const cache, const char * query, - size_t query_len); -void mysqlnd_qcache_put(MYSQLND_QCACHE * const cache, char * query, size_t query_len, - MYSQLND_RES_BUFFERED * const result, MYSQLND_RES_METADATA * const meta); - /* double check the class name to avoid naming conflicts when using these: */ #define MYSQLND_METHOD(class, method) php_##class##_##method##_pub #define MYSQLND_METHOD_PRIVATE(class, method) php_##class##_##method##_priv Deleted: php/php-src/trunk/ext/mysqlnd/mysqlnd_qcache.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_qcache.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_qcache.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -1,141 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | PHP Version 6 | - +----------------------------------------------------------------------+ - | Copyright (c) 2006-2009 The PHP Group | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | lice...@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Georg Richter <ge...@mysql.com> | - | Andrey Hristov <and...@mysql.com> | - | Ulf Wendel <uwen...@mysql.com> | - +----------------------------------------------------------------------+ -*/ - -/* $Id$ */ -#include "php.h" -#include "mysqlnd.h" -#include "mysqlnd_priv.h" -#include "mysqlnd_statistics.h" - -#define MYSQLND_SILENT - -#ifdef ZTS -#define LOCK_QCACHE(cache) tsrm_mutex_lock((cache)->LOCK_access) -#define UNLOCK_QCACHE(cache) tsrm_mutex_unlock((cache)->LOCK_access) -#else -#define LOCK_QCACHE(cache) -#define UNLOCK_QCACHE(cache) -#endif - - -/* {{{ mysqlnd_qcache_init_cache */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_init_cache() -{ - MYSQLND_QCACHE *cache = calloc(1, sizeof(MYSQLND_QCACHE)); -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_init_cache %p]\n", cache); -#endif - - cache->references = 1; -#ifdef ZTS - cache->LOCK_access = tsrm_mutex_alloc(); -#endif - cache->ht = malloc(sizeof(HashTable)); - zend_hash_init(cache->ht, 10 /* init_elements */, NULL, NULL, TRUE /*pers*/); - - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_get_cache_reference */ -PHPAPI MYSQLND_QCACHE * mysqlnd_qcache_get_cache_reference(MYSQLND_QCACHE * const cache) -{ - if (cache) { -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_get_cache_reference %p will become %d]\n", cache, cache->references+1); -#endif - LOCK_QCACHE(cache); - cache->references++; - UNLOCK_QCACHE(cache); - } - return cache; -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache */ -/* - As this call will happen on MSHUTDOWN(), then we don't need to copy the zvals with - copy_ctor but scrap what they point to with zval_dtor() and then just free our - pre-allocated block. Precondition is that we ZVAL_NULL() the zvals when we put them - to the free list after usage. We ZVAL_NULL() them when we allocate them in the - constructor of the cache. -*/ -static -void mysqlnd_qcache_free_cache(MYSQLND_QCACHE *cache) -{ -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache %p]\n", cache); -#endif - -#ifdef ZTS - tsrm_mutex_free(cache->LOCK_access); -#endif - zend_hash_destroy(cache->ht); - free(cache->ht); - free(cache); -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_free_cache_reference(MYSQLND_QCACHE **cache) -{ - if (*cache) { - zend_bool to_free; -#ifndef MYSQLND_SILENT - php_printf("[mysqlnd_qcache_free_cache_reference %p] refs=%d\n", *cache, (*cache)->references); -#endif - LOCK_QCACHE(*cache); - to_free = --(*cache)->references == 0; - /* Unlock before destroying */ - UNLOCK_QCACHE(*cache); - if (to_free) { - mysqlnd_qcache_free_cache(*cache); - } - *cache = NULL; - } -} -/* }}} */ - - -/* {{{ mysqlnd_qcache_free_cache_reference */ -PHPAPI void mysqlnd_qcache_stats(const MYSQLND_QCACHE * const cache, zval *return_value) -{ - if (cache) { - LOCK_QCACHE(cache); - array_init(return_value); - add_assoc_long_ex(return_value, "references", sizeof("references"), cache->references); - UNLOCK_QCACHE(cache); - } else { - ZVAL_NULL(return_value); - } -} -/* }}} */ - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2009-12-09 20:38:11 UTC (rev 291932) @@ -223,9 +223,6 @@ } set->data_cursor = NULL; set->row_count = 0; - if (set->qcache) { - mysqlnd_qcache_free_cache_reference(&set->qcache); - } DBG_INF("Freeing set"); mnd_pefree(set, set->persistent); @@ -1069,7 +1066,6 @@ set->row_buffers = mnd_pemalloc(free_rows * sizeof(MYSQLND_MEMORY_POOL_CHUNK *), to_cache); } set->persistent = to_cache; - set->qcache = to_cache? mysqlnd_qcache_get_cache_reference(conn->qcache):NULL; set->references = 1; result->m.row_decoder = binary_protocol? php_mysqlnd_rowp_read_binary_protocol: Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2009-12-09 20:33:31 UTC (rev 291931) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_structs.h 2009-12-09 20:38:11 UTC (rev 291932) @@ -107,9 +107,6 @@ } mysqlnd_error_info; -typedef struct st_mysqlnd_qcache MYSQLND_QCACHE; - - typedef struct st_mysqlnd_infile_info { php_stream *fd; @@ -480,9 +477,6 @@ /* options */ MYSQLND_OPTION options; - /* qcache */ - MYSQLND_QCACHE *qcache; - /* stats */ MYSQLND_STATS stats; @@ -526,7 +520,6 @@ uint64_t initialized_rows; zend_bool persistent; - MYSQLND_QCACHE *qcache; unsigned int references; mysqlnd_error_info error_info;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php