]> granicus.if.org Git - php/commitdiff
shift code around to two new files - mysqlnd_driver.c
authorAndrey Hristov <andrey@php.net>
Fri, 21 Oct 2011 15:28:58 +0000 (15:28 +0000)
committerAndrey Hristov <andrey@php.net>
Fri, 21 Oct 2011 15:28:58 +0000 (15:28 +0000)
and mysqlnd_ext_plugin.c (mysqlnd extension plugin)

15 files changed:
ext/mysqlnd/CREDITS
ext/mysqlnd/config.w32
ext/mysqlnd/config9.m4
ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd.h
ext/mysqlnd/mysqlnd_net.c
ext/mysqlnd/mysqlnd_net.h
ext/mysqlnd/mysqlnd_plugin.c
ext/mysqlnd/mysqlnd_priv.h
ext/mysqlnd/mysqlnd_ps.c
ext/mysqlnd/mysqlnd_result.c
ext/mysqlnd/mysqlnd_result.h
ext/mysqlnd/mysqlnd_structs.h
ext/mysqlnd/mysqlnd_wireprotocol.c
ext/mysqlnd/mysqlnd_wireprotocol.h

index bac8d1a4a2b7e6984540c34d4e10f2f3fc25c3db..5aed316e896feb61d4366da8c89b5ee9a75d0f51 100644 (file)
@@ -1,2 +1,2 @@
 MySQLnd
-Georg Richter, Andrey Hristov, Ulf Wendel
+Andrey Hristov, Ulf Wendel, Georg Richter
index 78f2da83dcbf9a463efbd1da424ebfb08fee51de..a910a0e509fa79bcb559c8707b0bc1c1d5b3d863 100644 (file)
@@ -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 " +
index 7ede3daffc200e62515f6b8bb9e107218b28b65b..a96cae9bf1e136d87159970da9f28b3cd57a243a 100644 (file)
@@ -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"
 
index 3a9b219a1c67876194d16ba81e32a18e2191880b..d374a0d6cc09d6b8d6da7eaca1faad38dedc1b21 100644 (file)
@@ -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
index 2946765b48338e07c686957aa764e81babbc91d8..25c92e76ecc894e71852d065b1c11f4cfabf2cc7 100644 (file)
@@ -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);
index 405919339cfdd3e320069cda4387b149e5628fbe..e36c3e80203a20fb32936e8f352983ed632be41f 100644 (file)
   | 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:
index cc3f823d8f6ea4537508df31b913fe61406e4599..ff8df9b5454afdc2bd33e58376e7e99f1b27e8dd 100644 (file)
@@ -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 */
 
 /*
index a35346de0b004278f660626a3c15338d0e672b48..096f10a0e55ce4ce26e621cb0463ec5b12a1c344 100644 (file)
 /* $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"
-
 
 /*--------------------------------------------------------------------*/
 
index 5bd688a2854174adbb10a2385f3ad0f7d9282caf..a069adced375bc5f26beb932c684ce905c9242ee 100644 (file)
@@ -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);
 
 
index c63fe9ffa87f02740edcd78e8674023091e9983f..91c4a7c24d288e01b76b8c55d1ce14ca4a65eb75 100644 (file)
@@ -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
index d4ca9c49c878962a940044f86e9129ee9d591cbf..dfcce71cce788d8e7d0904f60d1daba9ba6dd137 100644 (file)
@@ -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
index abd8c68204fc2b27582b4d223ac947b8e4bb257e..d005b41734aa6832a78fe3e437708c4fd27e3e83 100644 (file)
@@ -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);
 
index dd7dced876757a7d1cccc771377b0ca0d72f095e..e681c897cef4a8681116ebc27b163a9169151ae1 100644 (file)
@@ -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;
 };
 
 
index eaf013eab9c777fbb4c6bb1f1a3e4317d1dd60f5..751474dc3252736f6c0695ccebb5137bd03abe93 100644 (file)
   | 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
index 3c7bb1ec62c6f3d8a96892b634b2d40a79efcf01..a3efb92192cc6722f5350ff390f5822a2cfb9ffb 100644 (file)
@@ -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 */