diff options
author | Andrey Hristov <andrey@php.net> | 2011-10-21 15:28:58 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 2011-10-21 15:28:58 +0000 |
commit | 139813877c9c2d7b513e48195438aa9caaf217e4 (patch) | |
tree | 6c912847207a7e7cf9783916f16261080c991fb3 | |
parent | ed12ebc79c6ce6947f29b09706b73a6d546fb7c7 (diff) | |
download | php-git-139813877c9c2d7b513e48195438aa9caaf217e4.tar.gz |
shift code around to two new files - mysqlnd_driver.c
and mysqlnd_ext_plugin.c (mysqlnd extension plugin)
-rw-r--r-- | ext/mysqlnd/CREDITS | 2 | ||||
-rw-r--r-- | ext/mysqlnd/config.w32 | 2 | ||||
-rw-r--r-- | ext/mysqlnd/config9.m4 | 2 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd.c | 131 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd.h | 27 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_net.c | 32 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_net.h | 6 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_plugin.c | 6 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_priv.h | 12 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_ps.c | 41 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_result.c | 29 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_result.h | 5 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_structs.h | 15 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.c | 30 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_wireprotocol.h | 1 |
15 files changed, 65 insertions, 276 deletions
diff --git a/ext/mysqlnd/CREDITS b/ext/mysqlnd/CREDITS index bac8d1a4a2..5aed316e89 100644 --- a/ext/mysqlnd/CREDITS +++ b/ext/mysqlnd/CREDITS @@ -1,2 +1,2 @@ MySQLnd -Georg Richter, Andrey Hristov, Ulf Wendel +Andrey Hristov, Ulf Wendel, Georg Richter diff --git a/ext/mysqlnd/config.w32 b/ext/mysqlnd/config.w32 index 78f2da83dc..a910a0e509 100644 --- a/ext/mysqlnd/config.w32 +++ b/ext/mysqlnd/config.w32 @@ -13,6 +13,8 @@ if (PHP_MYSQLND != "no") { "mysqlnd_bt.c " + "mysqlnd_charset.c " + "mysqlnd_debug.c " + + "mysqlnd_driver.c " + + "mysqlnd_ext_plugin.c " + "mysqlnd_loaddata.c " + "mysqlnd_reverse_api.c " + "mysqlnd_net.c " + diff --git a/ext/mysqlnd/config9.m4 b/ext/mysqlnd/config9.m4 index 7ede3daffc..a96cae9bf1 100644 --- a/ext/mysqlnd/config9.m4 +++ b/ext/mysqlnd/config9.m4 @@ -20,7 +20,7 @@ if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes"; then mysqlnd_ps_sources="mysqlnd_ps.c mysqlnd_ps_codec.c" mysqlnd_base_sources="mysqlnd.c mysqlnd_alloc.c mysqlnd_bt.c mysqlnd_charset.c mysqlnd_wireprotocol.c \ mysqlnd_loaddata.c mysqlnd_reverse_api.c mysqlnd_net.c \ - mysqlnd_statistics.c mysqlnd_auth.c \ + mysqlnd_statistics.c mysqlnd_driver.c mysqlnd_ext_plugin.c mysqlnd_auth.c \ mysqlnd_result.c mysqlnd_result_meta.c mysqlnd_debug.c\ mysqlnd_block_alloc.c mysqlnd_plugin.c php_mysqlnd.c" diff --git a/ext/mysqlnd/mysqlnd.c b/ext/mysqlnd/mysqlnd.c index 3a9b219a1c..d374a0d6cc 100644 --- a/ext/mysqlnd/mysqlnd.c +++ b/ext/mysqlnd/mysqlnd.c @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -27,7 +27,6 @@ #include "mysqlnd_statistics.h" #include "mysqlnd_charset.h" #include "mysqlnd_debug.h" -#include "mysqlnd_reverse_api.h" /* TODO : @@ -63,9 +62,6 @@ PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't PHPAPI const char * const mysqlnd_out_of_memory = "Out of memory"; PHPAPI MYSQLND_STATS *mysqlnd_global_stats = NULL; -static zend_bool mysqlnd_library_initted = FALSE; - -static struct st_mysqlnd_conn_methods *mysqlnd_conn_methods; static struct st_mysqlnd_plugin_core mysqlnd_plugin_core; @@ -83,21 +79,6 @@ mysqlnd_error_list_pdtor(void * pDest) } /* }}} */ - -/* {{{ mysqlnd_library_end */ -PHPAPI void mysqlnd_library_end(TSRMLS_D) -{ - if (mysqlnd_library_initted == TRUE) { - mysqlnd_plugin_subsystem_end(TSRMLS_C); - mysqlnd_stats_end(mysqlnd_global_stats); - mysqlnd_global_stats = NULL; - mysqlnd_library_initted = FALSE; - mysqlnd_reverse_api_end(TSRMLS_C); - } -} -/* }}} */ - - /* {{{ mysqlnd_conn::free_options */ static void MYSQLND_METHOD(mysqlnd_conn, free_options)(MYSQLND * conn TSRMLS_DC) @@ -2395,11 +2376,24 @@ MYSQLND_METHOD(mysqlnd_conn, tx_rollback)(MYSQLND * conn TSRMLS_DC) /* }}} */ +/* {{{ mysqlnd_conn::init */ +static enum_func_status +MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC) +{ + DBG_ENTER("mysqlnd_conn::init"); + mysqlnd_stats_init(&conn->stats, STAT_LAST); + SET_ERROR_AFF_ROWS(conn); + + conn->net = mysqlnd_net_init(conn->persistent, conn->stats, &conn->error_info TSRMLS_CC); + conn->protocol = mysqlnd_protocol_init(conn->persistent TSRMLS_CC); + + DBG_RETURN(conn->stats && conn->net && conn->protocol? PASS:FAIL); +} +/* }}} */ MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC); -static enum_func_status MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC); -static + MYSQLND_CLASS_METHODS_START(mysqlnd_conn) MYSQLND_METHOD(mysqlnd_conn, init), MYSQLND_METHOD(mysqlnd_conn, connect), @@ -2476,22 +2470,6 @@ MYSQLND_CLASS_METHODS_START(mysqlnd_conn) MYSQLND_CLASS_METHODS_END; -/* {{{ mysqlnd_conn::init */ -static enum_func_status -MYSQLND_METHOD(mysqlnd_conn, init)(MYSQLND * conn TSRMLS_DC) -{ - DBG_ENTER("mysqlnd_conn::init"); - mysqlnd_stats_init(&conn->stats, STAT_LAST); - SET_ERROR_AFF_ROWS(conn); - - conn->net = mysqlnd_net_init(conn->persistent, conn->stats, &conn->error_info TSRMLS_CC); - conn->protocol = mysqlnd_protocol_init(conn->persistent TSRMLS_CC); - - DBG_RETURN(conn->stats && conn->net && conn->protocol? PASS:FAIL); -} -/* }}} */ - - /* {{{ mysqlnd_init */ PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC) { @@ -2506,7 +2484,7 @@ PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC) } ret->persistent = persistent; - ret->m = mysqlnd_conn_methods; + ret->m = mysqlnd_conn_get_methods(); CONN_SET_STATE(ret, CONN_ALLOCED); ret->m->get_reference(ret TSRMLS_CC); @@ -2527,79 +2505,6 @@ PHPAPI MYSQLND * _mysqlnd_init(zend_bool persistent TSRMLS_DC) } /* }}} */ - -/* {{{ mysqlnd_library_init */ -PHPAPI void mysqlnd_library_init(TSRMLS_D) -{ - if (mysqlnd_library_initted == FALSE) { - mysqlnd_library_initted = TRUE; - mysqlnd_conn_methods = &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_conn); - _mysqlnd_init_ps_subsystem(); - /* Should be calloc, as mnd_calloc will reference LOCK_access*/ - mysqlnd_stats_init(&mysqlnd_global_stats, STAT_LAST); - mysqlnd_plugin_subsystem_init(TSRMLS_C); - { - mysqlnd_plugin_core.plugin_header.plugin_stats.values = mysqlnd_global_stats; - mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_plugin_core TSRMLS_CC); - } - mysqlnd_example_plugin_register(TSRMLS_C); - mysqlnd_debug_trace_plugin_register(TSRMLS_C); - mysqlnd_register_builtin_authentication_plugins(TSRMLS_C); - - mysqlnd_reverse_api_init(TSRMLS_C); - } -} -/* }}} */ - - -/* {{{ mysqlnd_conn_get_methods */ -PHPAPI struct st_mysqlnd_conn_methods * mysqlnd_conn_get_methods() -{ - return mysqlnd_conn_methods; -} -/* }}} */ - -/* {{{ mysqlnd_conn_set_methods */ -PHPAPI void mysqlnd_conn_set_methods(struct st_mysqlnd_conn_methods *methods) -{ - mysqlnd_conn_methods = methods; -} -/* }}} */ - - -/* {{{ _mysqlnd_plugin_get_plugin_connection_data */ -PHPAPI void ** _mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn, unsigned int plugin_id TSRMLS_DC) -{ - DBG_ENTER("_mysqlnd_plugin_get_plugin_connection_data"); - DBG_INF_FMT("plugin_id=%u", plugin_id); - if (!conn || plugin_id >= mysqlnd_plugin_count()) { - return NULL; - } - DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); -} -/* }}} */ - - -static struct st_mysqlnd_plugin_core mysqlnd_plugin_core = -{ - { - MYSQLND_PLUGIN_API_VERSION, - "mysqlnd", - MYSQLND_VERSION_ID, - MYSQLND_VERSION, - "PHP License 3.01", - "Andrey Hristov <andrey@mysql.com>, Ulf Wendel <uwendel@mysql.com>, Georg Richter <georg@mysql.com>", - { - NULL, /* will be filled later */ - mysqlnd_stats_values_names, - }, - { - NULL /* plugin shutdown */ - } - } -}; - - /* * Local variables: * tab-width: 4 diff --git a/ext/mysqlnd/mysqlnd.h b/ext/mysqlnd/mysqlnd.h index 2946765b48..25c92e76ec 100644 --- a/ext/mysqlnd/mysqlnd.h +++ b/ext/mysqlnd/mysqlnd.h @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ /* $Id$ */ @@ -78,29 +78,6 @@ PHPAPI void * _mysqlnd_plugin_find(const char * const name TSRMLS_DC); PHPAPI void _mysqlnd_plugin_apply_with_argument(apply_func_arg_t apply_func, void * argument TSRMLS_DC); #define mysqlnd_plugin_apply_with_argument(func, argument) _mysqlnd_plugin_apply_with_argument((func), (argument) TSRMLS_CC); -PHPAPI void ** _mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn, unsigned int plugin_id TSRMLS_DC); -#define mysqlnd_plugin_get_plugin_connection_data(c, p_id) _mysqlnd_plugin_get_plugin_connection_data((c), (p_id) TSRMLS_CC) - -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 void ** _mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC); -#define mysqlnd_plugin_get_plugin_protocol_data(p, p_id) _mysqlnd_plugin_get_plugin_protocol_data((p), (p_id) TSRMLS_CC) - -PHPAPI void ** _mysqlnd_plugin_get_plugin_net_data(const MYSQLND_NET * net, unsigned int plugin_id TSRMLS_DC); -#define mysqlnd_plugin_get_plugin_net_data(n, p_id) _mysqlnd_plugin_get_plugin_net_data((n), (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); - -PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods(); -PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods); - - #define mysqlnd_restart_psession(conn) (conn)->m->restart_psession((conn) TSRMLS_CC) #define mysqlnd_end_psession(conn) (conn)->m->end_psession((conn) TSRMLS_CC) PHPAPI void mysqlnd_minfo_print_hash(zval *values); diff --git a/ext/mysqlnd/mysqlnd_net.c b/ext/mysqlnd/mysqlnd_net.c index 405919339c..e36c3e8020 100644 --- a/ext/mysqlnd/mysqlnd_net.c +++ b/ext/mysqlnd/mysqlnd_net.c @@ -12,11 +12,13 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ + +/* $Id: mysqlnd_ps.c 316906 2011-09-17 10:24:18Z pajoye $ */ #include "php.h" #include "php_globals.h" #include "mysqlnd.h" @@ -24,7 +26,7 @@ #include "mysqlnd_wireprotocol.h" #include "mysqlnd_statistics.h" #include "mysqlnd_debug.h" -#include "ext/standard/sha1.h" +#include "mysqlnd_ext_plugin.h" #include "php_network.h" #include "zend_ini.h" #ifdef MYSQLND_COMPRESSION_ENABLED @@ -1002,7 +1004,6 @@ MYSQLND_METHOD(mysqlnd_net, dtor)(MYSQLND_NET * const net, MYSQLND_STATS * const /* }}} */ -static MYSQLND_CLASS_METHODS_START(mysqlnd_net) MYSQLND_METHOD(mysqlnd_net, init), MYSQLND_METHOD(mysqlnd_net, dtor), @@ -1043,7 +1044,7 @@ mysqlnd_net_init(zend_bool persistent, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO DBG_INF_FMT("persistent=%u", persistent); if (net) { net->persistent = persistent; - net->m = mysqlnd_mysqlnd_net_methods; + net->m = *mysqlnd_net_get_methods(); if (PASS != net->m.init(net, stats, error_info TSRMLS_CC)) { net->m.dtor(net, stats, error_info TSRMLS_CC); @@ -1068,27 +1069,6 @@ mysqlnd_net_free(MYSQLND_NET * const net, MYSQLND_STATS * stats, MYSQLND_ERROR_I /* }}} */ -/* {{{ _mysqlnd_plugin_get_plugin_net_data */ -PHPAPI void ** _mysqlnd_plugin_get_plugin_net_data(const MYSQLND_NET * net, unsigned int plugin_id TSRMLS_DC) -{ - DBG_ENTER("_mysqlnd_plugin_get_plugin_net_data"); - DBG_INF_FMT("plugin_id=%u", plugin_id); - if (!net || plugin_id >= mysqlnd_plugin_count()) { - return NULL; - } - DBG_RETURN((void *)((char *)net + sizeof(MYSQLND_NET) + plugin_id * sizeof(void *))); -} -/* }}} */ - - -/* {{{ mysqlnd_net_get_methods */ -PHPAPI struct st_mysqlnd_net_methods * -mysqlnd_net_get_methods() -{ - return &mysqlnd_mysqlnd_net_methods; -} -/* }}} */ - /* * Local variables: diff --git a/ext/mysqlnd/mysqlnd_net.h b/ext/mysqlnd/mysqlnd_net.h index cc3f823d8f..ff8df9b545 100644 --- a/ext/mysqlnd/mysqlnd_net.h +++ b/ext/mysqlnd/mysqlnd_net.h @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -26,8 +26,6 @@ PHPAPI MYSQLND_NET * mysqlnd_net_init(zend_bool persistent, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info TSRMLS_DC); PHPAPI void mysqlnd_net_free(MYSQLND_NET * const net, MYSQLND_STATS * stats, MYSQLND_ERROR_INFO * error_info TSRMLS_DC); -PHPAPI struct st_mysqlnd_net_methods * mysqlnd_net_get_methods(); - #endif /* MYSQLND_NET_H */ /* diff --git a/ext/mysqlnd/mysqlnd_plugin.c b/ext/mysqlnd/mysqlnd_plugin.c index a35346de0b..096f10a0e5 100644 --- a/ext/mysqlnd/mysqlnd_plugin.c +++ b/ext/mysqlnd/mysqlnd_plugin.c @@ -21,15 +21,9 @@ /* $Id: mysqlnd.c 306407 2010-12-16 12:56:19Z andrey $ */ #include "php.h" #include "mysqlnd.h" -#include "mysqlnd_wireprotocol.h" #include "mysqlnd_priv.h" -#include "mysqlnd_result.h" #include "mysqlnd_statistics.h" -#include "mysqlnd_charset.h" #include "mysqlnd_debug.h" -/* for php_get_current_user() */ -#include "ext/standard/basic_functions.h" - /*--------------------------------------------------------------------*/ diff --git a/ext/mysqlnd/mysqlnd_priv.h b/ext/mysqlnd/mysqlnd_priv.h index 5bd688a285..a069adced3 100644 --- a/ext/mysqlnd/mysqlnd_priv.h +++ b/ext/mysqlnd/mysqlnd_priv.h @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -48,8 +48,9 @@ #endif #define MYSQLND_CLASS_METHOD_TABLE_NAME(class) mysqlnd_##class##_methods -#define MYSQLND_CLASS_METHODS_START(class) struct st_##class##_methods MYSQLND_CLASS_METHOD_TABLE_NAME(class) = { +#define MYSQLND_CLASS_METHODS_START(class) MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(class) = { #define MYSQLND_CLASS_METHODS_END } +#define MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(class) struct st_##class##_methods MYSQLND_CLASS_METHOD_TABLE_NAME(class) #if MYSQLND_UNICODE #define mysqlnd_array_init(arg, field_count) \ @@ -204,6 +205,11 @@ PHPAPI extern const char * const mysqlnd_out_of_sync; PHPAPI extern const char * const mysqlnd_server_gone; PHPAPI extern const char * const mysqlnd_out_of_memory; +extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_conn); +extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_res); +extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_protocol); +extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_net); + enum_func_status mysqlnd_handle_local_infile(MYSQLND *conn, const char *filename, zend_bool *is_warning TSRMLS_DC); diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index c63fe9ffa8..91c4a7c24d 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -28,7 +28,7 @@ #include "mysqlnd_statistics.h" #include "mysqlnd_debug.h" #include "mysqlnd_block_alloc.h" - +#include "mysqlnd_ext_plugin.h" #define MYSQLND_SILENT @@ -36,8 +36,6 @@ const char * const mysqlnd_not_bound_as_blob = "Can't send long data for non-string/non-binary data types"; const char * const mysqlnd_stmt_not_prepared = "Statement not prepared"; -static struct st_mysqlnd_stmt_methods *mysqlnd_stmt_methods; - /* Exported by mysqlnd_ps_codec.c */ enum_func_status mysqlnd_stmt_execute_generate_request(MYSQLND_STMT * const s, zend_uchar ** request, size_t *request_len, zend_bool * free_buffer TSRMLS_DC); @@ -2375,7 +2373,7 @@ MYSQLND_STMT * _mysqlnd_stmt_init(MYSQLND * const conn TSRMLS_DC) if (!ret) { break; } - ret->m = mysqlnd_stmt_methods; + ret->m = mysqlnd_stmt_get_methods(); ret->persistent = conn->persistent; stmt = ret->data = mnd_pecalloc(1, sizeof(MYSQLND_STMT_DATA), conn->persistent); @@ -2417,44 +2415,15 @@ 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_init_ps_subsystem */ void _mysqlnd_init_ps_subsystem() { - mysqlnd_stmt_methods = &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_stmt); + mysqlnd_stmt_set_methods(&MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_stmt)); _mysqlnd_init_ps_fetch_subsystem(); } /* }}} */ -/* {{{ mysqlnd_conn_get_methods */ -PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods() -{ - return mysqlnd_stmt_methods; -} -/* }}} */ - - -/* {{{ mysqlnd_conn_set_methods */ -PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods) -{ - mysqlnd_stmt_methods = methods; -} -/* }}} */ - - /* * Local variables: * tab-width: 4 diff --git a/ext/mysqlnd/mysqlnd_result.c b/ext/mysqlnd/mysqlnd_result.c index d4ca9c49c8..dfcce71cce 100644 --- a/ext/mysqlnd/mysqlnd_result.c +++ b/ext/mysqlnd/mysqlnd_result.c @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -28,6 +28,7 @@ #include "mysqlnd_result_meta.h" #include "mysqlnd_statistics.h" #include "mysqlnd_debug.h" +#include "mysqlnd_ext_plugin.h" #define MYSQLND_SILENT @@ -1634,7 +1635,6 @@ MYSQLND_METHOD(mysqlnd_res, fetch_field_data)(MYSQLND_RES * result, unsigned int /* }}} */ -static MYSQLND_CLASS_METHODS_START(mysqlnd_res) NULL, /* fetch_row */ mysqlnd_fetch_row_buffered, @@ -1686,34 +1686,13 @@ mysqlnd_result_init(unsigned int field_count, zend_bool persistent TSRMLS_DC) ret->persistent = persistent; ret->field_count = field_count; - ret->m = mysqlnd_mysqlnd_res_methods; + ret->m = *mysqlnd_result_get_methods(); DBG_RETURN(ret); } /* }}} */ -/* {{{ _mysqlnd_plugin_get_plugin_result_data */ -PHPAPI void ** _mysqlnd_plugin_get_plugin_result_data(const MYSQLND_RES * result, unsigned int plugin_id TSRMLS_DC) -{ - DBG_ENTER("_mysqlnd_plugin_get_plugin_result_data"); - DBG_INF_FMT("plugin_id=%u", plugin_id); - if (!result || plugin_id >= mysqlnd_plugin_count()) { - return NULL; - } - DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *))); -} -/* }}} */ - - -/* {{{ mysqlnd_result_get_methods */ -PHPAPI struct st_mysqlnd_res_methods * -mysqlnd_result_get_methods() -{ - return &mysqlnd_mysqlnd_res_methods; -} -/* }}} */ - /* * Local variables: * tab-width: 4 diff --git a/ext/mysqlnd/mysqlnd_result.h b/ext/mysqlnd/mysqlnd_result.h index abd8c68204..d005b41734 100644 --- a/ext/mysqlnd/mysqlnd_result.h +++ b/ext/mysqlnd/mysqlnd_result.h @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -24,7 +24,6 @@ #define MYSQLND_RESULT_H PHPAPI MYSQLND_RES * mysqlnd_result_init(unsigned int field_count, zend_bool persistent TSRMLS_DC); -PHPAPI struct st_mysqlnd_res_methods * mysqlnd_result_get_methods(); enum_func_status mysqlnd_query_read_result_set_header(MYSQLND * conn, MYSQLND_STMT * stmt TSRMLS_DC); diff --git a/ext/mysqlnd/mysqlnd_structs.h b/ext/mysqlnd/mysqlnd_structs.h index dd7dced876..e681c897ce 100644 --- a/ext/mysqlnd/mysqlnd_structs.h +++ b/ext/mysqlnd/mysqlnd_structs.h @@ -12,9 +12,9 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ @@ -367,7 +367,6 @@ struct st_mysqlnd_protocol_methods }; - typedef enum_func_status (*func_mysqlnd_conn__init)(MYSQLND * conn TSRMLS_DC); typedef enum_func_status (*func_mysqlnd_conn__connect)(MYSQLND *conn, const char *host, const char * user, const char * passwd, unsigned int passwd_len, const char * db, unsigned int db_len, unsigned int port, const char * socket_or_pipe, unsigned int mysql_flags TSRMLS_DC); typedef ulong (*func_mysqlnd_conn__escape_string)(MYSQLND * const conn, char *newstr, const char *escapestr, size_t escapestr_len TSRMLS_DC); @@ -735,9 +734,13 @@ struct st_mysqlnd_net zend_uchar compressed_envelope_packet_no; #ifdef MYSQLND_COMPRESSION_ENABLED MYSQLND_READ_BUFFER * uncompressed_data; +#else + void * unused_pad1; #endif #ifdef MYSQLND_DO_WIRE_CHECK_BEFORE_COMMAND zend_uchar last_command; +#else + zend_uchar unused_pad2; #endif /* cmd buffer */ MYSQLND_CMD_BUFFER cmd_buffer; @@ -752,8 +755,8 @@ struct st_mysqlnd_net struct st_mysqlnd_protocol { - struct st_mysqlnd_protocol_methods m; zend_bool persistent; + struct st_mysqlnd_protocol_methods m; }; @@ -885,8 +888,6 @@ struct st_mysqlnd_unbuffered_result struct st_mysqlnd_res { - struct st_mysqlnd_res_methods m; - MYSQLND *conn; enum_mysqlnd_res_type type; unsigned int field_count; @@ -908,6 +909,8 @@ struct st_mysqlnd_res MYSQLND_MEMORY_POOL * result_set_memory_pool; zend_bool persistent; + + struct st_mysqlnd_res_methods m; }; diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.c b/ext/mysqlnd/mysqlnd_wireprotocol.c index eaf013eab9..751474dc32 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.c +++ b/ext/mysqlnd/mysqlnd_wireprotocol.c @@ -12,11 +12,13 @@ | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Georg Richter <georg@mysql.com> | - | Andrey Hristov <andrey@mysql.com> | + | Authors: Andrey Hristov <andrey@mysql.com> | | Ulf Wendel <uwendel@mysql.com> | + | Georg Richter <georg@mysql.com> | +----------------------------------------------------------------------+ */ + +/* $Id$ */ #include "php.h" #include "php_globals.h" #include "mysqlnd.h" @@ -2348,7 +2350,6 @@ MYSQLND_METHOD(mysqlnd_protocol, get_change_user_response_packet)(MYSQLND_PROTOC /* }}} */ -static MYSQLND_CLASS_METHODS_START(mysqlnd_protocol) MYSQLND_METHOD(mysqlnd_protocol, get_greet_packet), MYSQLND_METHOD(mysqlnd_protocol, get_auth_packet), @@ -2400,29 +2401,6 @@ mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC) /* }}} */ -/* {{{ _mysqlnd_plugin_get_plugin_protocol_data */ -PHPAPI void ** -_mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC) -{ - DBG_ENTER("_mysqlnd_plugin_get_plugin_protocol_data"); - DBG_INF_FMT("plugin_id=%u", plugin_id); - if (!protocol || plugin_id >= mysqlnd_plugin_count()) { - return NULL; - } - DBG_RETURN((void *)((char *)protocol + sizeof(MYSQLND_PROTOCOL) + plugin_id * sizeof(void *))); -} -/* }}} */ - - -/* {{{ mysqlnd_protocol_get_methods */ -PHPAPI struct st_mysqlnd_protocol_methods * -mysqlnd_protocol_get_methods() -{ - return &mysqlnd_mysqlnd_protocol_methods; -} -/* }}} */ - - /* * Local variables: * tab-width: 4 diff --git a/ext/mysqlnd/mysqlnd_wireprotocol.h b/ext/mysqlnd/mysqlnd_wireprotocol.h index 3c7bb1ec62..a3efb92192 100644 --- a/ext/mysqlnd/mysqlnd_wireprotocol.h +++ b/ext/mysqlnd/mysqlnd_wireprotocol.h @@ -308,7 +308,6 @@ enum_func_status php_mysqlnd_rowp_read_text_protocol(MYSQLND_MEMORY_POOL_CHUNK * PHPAPI MYSQLND_PROTOCOL * mysqlnd_protocol_init(zend_bool persistent TSRMLS_DC); PHPAPI void mysqlnd_protocol_free(MYSQLND_PROTOCOL * const protocol TSRMLS_DC); -PHPAPI struct st_mysqlnd_protocol_methods * mysqlnd_protocol_get_methods(); #endif /* MYSQLND_WIREPROTOCOL_H */ |