andrey                                   Fri, 14 May 2010 16:42:17 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=299389

Log:
result_meta local storage

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
    U   php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.h
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c
    U   php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.h

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c      
2010-05-14 16:10:33 UTC (rev 299388)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.c      
2010-05-14 16:42:17 UTC (rev 299389)
@@ -442,14 +442,14 @@
 PHPAPI MYSQLND_RES_METADATA *
 mysqlnd_result_meta_init(unsigned int field_count, zend_bool persistent 
TSRMLS_DC)
 {
-       MYSQLND_RES_METADATA *ret;
+       size_t alloc_size = sizeof(MYSQLND_RES_METADATA) + 
mysqlnd_plugin_count() * sizeof(void *);
+       MYSQLND_RES_METADATA *ret = mnd_pecalloc(1, alloc_size, persistent);
        DBG_ENTER("mysqlnd_result_meta_init");
        DBG_INF_FMT("persistent=%d", persistent);

-       /* +1 is to have empty marker at the end */
-       ret = mnd_pecalloc(1, sizeof(MYSQLND_RES_METADATA), persistent);
        ret->persistent = persistent;
        ret->field_count = field_count;
+       /* +1 is to have empty marker at the end */
        ret->fields = mnd_pecalloc(field_count + 1, sizeof(MYSQLND_FIELD), 
ret->persistent);
        ret->zend_hash_keys = mnd_pecalloc(field_count, sizeof(struct 
mysqlnd_field_hash_key), ret->persistent);

@@ -468,6 +468,19 @@
 /* }}} */


+/* {{{ _mysqlnd_plugin_get_plugin_result_metadata_data */
+PHPAPI void **
+_mysqlnd_plugin_get_plugin_result_metadata_data(const MYSQLND_RES_METADATA * 
meta, unsigned int plugin_id TSRMLS_DC)
+{
+       DBG_ENTER("_mysqlnd_plugin_get_plugin_result_metadata_data");
+       DBG_INF_FMT("plugin_id=%u", plugin_id);
+       if (!meta || plugin_id >= mysqlnd_plugin_count()) {
+               return NULL;
+       }
+       DBG_RETURN((void *)((char *)meta + sizeof(MYSQLND_RES_METADATA) + 
plugin_id * sizeof(void *)));
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4

Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.h
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.h      
2010-05-14 16:10:33 UTC (rev 299388)
+++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result_meta.h      
2010-05-14 16:42:17 UTC (rev 299389)
@@ -25,6 +25,7 @@

 PHPAPI MYSQLND_RES_METADATA * mysqlnd_result_meta_init(unsigned int 
field_count, zend_bool persistent TSRMLS_DC);
 PHPAPI struct st_mysqlnd_res_meta_methods * 
mysqlnd_result_metadata_get_methods();
+PHPAPI void ** _mysqlnd_plugin_get_plugin_result_metadata_data(const 
MYSQLND_RES_METADATA * meta, unsigned int plugin_id TSRMLS_DC);

 #endif /* MYSQLND_RESULT_META_H */


Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-05-14 16:10:33 UTC 
(rev 299388)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.c 2010-05-14 16:42:17 UTC 
(rev 299389)
@@ -442,14 +442,14 @@
 PHPAPI MYSQLND_RES_METADATA *
 mysqlnd_result_meta_init(unsigned int field_count, zend_bool persistent 
TSRMLS_DC)
 {
-       MYSQLND_RES_METADATA *ret;
+       size_t alloc_size = sizeof(MYSQLND_RES_METADATA) + 
mysqlnd_plugin_count() * sizeof(void *);
+       MYSQLND_RES_METADATA *ret = mnd_pecalloc(1, alloc_size, persistent);
        DBG_ENTER("mysqlnd_result_meta_init");
        DBG_INF_FMT("persistent=%d", persistent);

-       /* +1 is to have empty marker at the end */
-       ret = mnd_pecalloc(1, sizeof(MYSQLND_RES_METADATA), persistent);
        ret->persistent = persistent;
        ret->field_count = field_count;
+       /* +1 is to have empty marker at the end */
        ret->fields = mnd_pecalloc(field_count + 1, sizeof(MYSQLND_FIELD), 
ret->persistent);
        ret->zend_hash_keys = mnd_pecalloc(field_count, sizeof(struct 
mysqlnd_field_hash_key), ret->persistent);

@@ -468,6 +468,19 @@
 /* }}} */


+/* {{{ _mysqlnd_plugin_get_plugin_result_metadata_data */
+PHPAPI void **
+_mysqlnd_plugin_get_plugin_result_metadata_data(const MYSQLND_RES_METADATA * 
meta, unsigned int plugin_id TSRMLS_DC)
+{
+       DBG_ENTER("_mysqlnd_plugin_get_plugin_result_metadata_data");
+       DBG_INF_FMT("plugin_id=%u", plugin_id);
+       if (!meta || plugin_id >= mysqlnd_plugin_count()) {
+               return NULL;
+       }
+       DBG_RETURN((void *)((char *)meta + sizeof(MYSQLND_RES_METADATA) + 
plugin_id * sizeof(void *)));
+}
+/* }}} */
+
 /*
  * Local variables:
  * tab-width: 4

Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.h
===================================================================
--- php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.h 2010-05-14 16:10:33 UTC 
(rev 299388)
+++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result_meta.h 2010-05-14 16:42:17 UTC 
(rev 299389)
@@ -25,6 +25,7 @@

 PHPAPI MYSQLND_RES_METADATA * mysqlnd_result_meta_init(unsigned int 
field_count, zend_bool persistent TSRMLS_DC);
 PHPAPI struct st_mysqlnd_res_meta_methods * 
mysqlnd_result_metadata_get_methods();
+PHPAPI void ** _mysqlnd_plugin_get_plugin_result_metadata_data(const 
MYSQLND_RES_METADATA * meta, unsigned int plugin_id TSRMLS_DC);

 #endif /* MYSQLND_RESULT_META_H */


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to