]> granicus.if.org Git - php/commitdiff
Add plugin storage for MYSQLND_STMT too
authorAndrey Hristov <andrey@php.net>
Thu, 10 Dec 2009 11:18:05 +0000 (11:18 +0000)
committerAndrey Hristov <andrey@php.net>
Thu, 10 Dec 2009 11:18:05 +0000 (11:18 +0000)
ext/mysqlnd/mysqlnd.h
ext/mysqlnd/mysqlnd_ps.c
ext/mysqlnd/mysqlnd_result.c

index 674d64b15e9f96990bfe22e313c278eb559c30be..2b355737a97db1582f6341d0c73bc99aa39b471e 100644 (file)
@@ -71,6 +71,9 @@ PHPAPI void ** _mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn,
 PHPAPI void ** _mysqlnd_plugin_get_plugin_result_data(const MYSQLND_RES * result, unsigned int plugin_id TSRMLS_DC);
 #define mysqlnd_plugin_get_plugin_result_data(r, p_id) _mysqlnd_plugin_get_plugin_result_data((r), (p_id) TSRMLS_CC)
 
+PHPAPI void ** _mysqlnd_plugin_get_plugin_stmt_data(const MYSQLND_STMT * stmt, unsigned int plugin_id TSRMLS_DC);
+#define mysqlnd_plugin_get_plugin_stmt_data(s, p_id) _mysqlnd_plugin_get_plugin_stmt_data((s), (p_id) TSRMLS_CC)
+
 
 PHPAPI struct st_mysqlnd_conn_methods * mysqlnd_conn_get_methods();
 PHPAPI void mysqlnd_conn_set_methods(struct st_mysqlnd_conn_methods *methods);
index 10045a8313c13adce6000b7bdc0953a30dd63b34..6f1bc97b9db9e0d2a2885223c70c89f690569a7f 100644 (file)
@@ -2081,7 +2081,8 @@ MYSQLND_CLASS_METHODS_END;
 /* {{{ _mysqlnd_stmt_init */
 MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC)
 {
-       MYSQLND_STMT *stmt = mnd_ecalloc(1, sizeof(MYSQLND_STMT));
+       size_t alloc_size = sizeof(MYSQLND_STMT) + mysqlnd_plugin_count() * sizeof(void *);
+       MYSQLND_STMT *stmt = mnd_ecalloc(1, alloc_size);
 
        DBG_ENTER("_mysqlnd_stmt_init");
        DBG_INF_FMT("stmt=%p", stmt); 
@@ -2107,6 +2108,19 @@ MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC)
 /* }}} */
 
 
+/* {{{ _mysqlnd_plugin_get_plugin_stmt_data */
+PHPAPI void ** _mysqlnd_plugin_get_plugin_stmt_data(const MYSQLND_STMT * stmt, unsigned int plugin_id TSRMLS_DC)
+{
+       DBG_ENTER("_mysqlnd_plugin_get_plugin_stmt_data");
+       DBG_INF_FMT("plugin_id=%u", plugin_id);
+       if (!stmt || plugin_id >= mysqlnd_plugin_count()) {
+               return NULL;
+       }
+       DBG_RETURN((void *)((char *)stmt + sizeof(MYSQLND_STMT) + plugin_id * sizeof(void *)));
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_efree_param_bind_dtor */
 PHPAPI void
 mysqlnd_efree_param_bind_dtor(MYSQLND_PARAM_BIND * param_bind TSRMLS_DC)
index 0fc0663e0b61e658e48664f320e19a280a200db1..22ea7d325dacf293bb55f0530b6335ea79932ddb 100644 (file)
@@ -1585,7 +1585,7 @@ PHPAPI void ** _mysqlnd_plugin_get_plugin_result_data(const MYSQLND_RES * result
        if (!result || plugin_id >= mysqlnd_plugin_count()) {
                return NULL;
        }
-       DBG_RETURN((void *)(result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *)));
+       DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *)));
 }
 /* }}} */