andrey Thu, 10 Dec 2009 11:18:05 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291946
Log: Add plugin storage for MYSQLND_STMT too Changed paths: U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c U php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c U php/php-src/trunk/ext/mysqlnd/mysqlnd.h U php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c U php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 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-10 11:09:15 UTC (rev 291945) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd.h 2009-12-10 11:18:05 UTC (rev 291946) @@ -71,7 +71,10 @@ 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); Modified: php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2009-12-10 11:09:15 UTC (rev 291945) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_ps.c 2009-12-10 11:18:05 UTC (rev 291946) @@ -2081,7 +2081,8 @@ /* {{{ _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_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) 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-10 11:09:15 UTC (rev 291945) +++ php/php-src/branches/PHP_5_3/ext/mysqlnd/mysqlnd_result.c 2009-12-10 11:18:05 UTC (rev 291946) @@ -1585,7 +1585,7 @@ 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 *))); } /* }}} */ Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd.h =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-10 11:09:15 UTC (rev 291945) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd.h 2009-12-10 11:18:05 UTC (rev 291946) @@ -71,7 +71,10 @@ 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); Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c 2009-12-10 11:09:15 UTC (rev 291945) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_ps.c 2009-12-10 11:18:05 UTC (rev 291946) @@ -2081,7 +2081,8 @@ /* {{{ _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_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) Modified: php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c =================================================================== --- php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2009-12-10 11:09:15 UTC (rev 291945) +++ php/php-src/trunk/ext/mysqlnd/mysqlnd_result.c 2009-12-10 11:18:05 UTC (rev 291946) @@ -1585,7 +1585,7 @@ 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 *))); } /* }}} */
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php