|
| 1 | +/* |
| 2 | + +----------------------------------------------------------------------+ |
| 3 | + | PHP Version 5 | |
| 4 | + +----------------------------------------------------------------------+ |
| 5 | + | Copyright (c) 2006-2011 The PHP Group | |
| 6 | + +----------------------------------------------------------------------+ |
| 7 | + | This source file is subject to version 3.01 of the PHP license, | |
| 8 | + | that is bundled with this package in the file LICENSE, and is | |
| 9 | + | available through the world-wide-web at the following url: | |
| 10 | + | http://www.php.net/license/3_01.txt | |
| 11 | + | If you did not receive a copy of the PHP license and are unable to | |
| 12 | + | obtain it through the world-wide-web, please send a note to | |
| 13 | + | license@php.net so we can mail you a copy immediately. | |
| 14 | + +----------------------------------------------------------------------+ |
| 15 | + | Authors: Andrey Hristov <andrey@mysql.com> | |
| 16 | + | Ulf Wendel <uwendel@mysql.com> | |
| 17 | + | Georg Richter <georg@mysql.com> | |
| 18 | + +----------------------------------------------------------------------+ |
| 19 | +*/ |
| 20 | + |
| 21 | +/* $Id: mysqlnd.c 318221 2011-10-19 15:04:12Z andrey $ */ |
| 22 | +#include "php.h" |
| 23 | +#include "mysqlnd.h" |
| 24 | +#include "mysqlnd_priv.h" |
| 25 | +#include "mysqlnd_result.h" |
| 26 | +#include "mysqlnd_debug.h" |
| 27 | + |
| 28 | +static struct st_mysqlnd_conn_methods * mysqlnd_conn_methods; |
| 29 | +static struct st_mysqlnd_stmt_methods * mysqlnd_stmt_methods; |
| 30 | + |
| 31 | +/* {{{ _mysqlnd_plugin_get_plugin_connection_data */ |
| 32 | +PHPAPI void ** |
| 33 | +_mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn, unsigned int plugin_id TSRMLS_DC) |
| 34 | +{ |
| 35 | + DBG_ENTER("_mysqlnd_plugin_get_plugin_connection_data"); |
| 36 | + DBG_INF_FMT("plugin_id=%u", plugin_id); |
| 37 | + if (!conn || plugin_id >= mysqlnd_plugin_count()) { |
| 38 | + return NULL; |
| 39 | + } |
| 40 | + DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); |
| 41 | +} |
| 42 | +/* }}} */ |
| 43 | + |
| 44 | + |
| 45 | +/* {{{ _mysqlnd_plugin_get_plugin_result_data */ |
| 46 | +PHPAPI void ** _mysqlnd_plugin_get_plugin_result_data(const MYSQLND_RES * result, unsigned int plugin_id TSRMLS_DC) |
| 47 | +{ |
| 48 | + DBG_ENTER("_mysqlnd_plugin_get_plugin_result_data"); |
| 49 | + DBG_INF_FMT("plugin_id=%u", plugin_id); |
| 50 | + if (!result || plugin_id >= mysqlnd_plugin_count()) { |
| 51 | + return NULL; |
| 52 | + } |
| 53 | + DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *))); |
| 54 | +} |
| 55 | +/* }}} */ |
| 56 | + |
| 57 | + |
| 58 | +/* {{{ _mysqlnd_plugin_get_plugin_protocol_data */ |
| 59 | +PHPAPI void ** |
| 60 | +_mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC) |
| 61 | +{ |
| 62 | + DBG_ENTER("_mysqlnd_plugin_get_plugin_protocol_data"); |
| 63 | + DBG_INF_FMT("plugin_id=%u", plugin_id); |
| 64 | + if (!protocol || plugin_id >= mysqlnd_plugin_count()) { |
| 65 | + return NULL; |
| 66 | + } |
| 67 | + DBG_RETURN((void *)((char *)protocol + sizeof(MYSQLND_PROTOCOL) + plugin_id * sizeof(void *))); |
| 68 | +} |
| 69 | +/* }}} */ |
| 70 | + |
| 71 | + |
| 72 | +/* {{{ _mysqlnd_plugin_get_plugin_stmt_data */ |
| 73 | +PHPAPI void ** _mysqlnd_plugin_get_plugin_stmt_data(const MYSQLND_STMT * stmt, unsigned int plugin_id TSRMLS_DC) |
| 74 | +{ |
| 75 | + DBG_ENTER("_mysqlnd_plugin_get_plugin_stmt_data"); |
| 76 | + DBG_INF_FMT("plugin_id=%u", plugin_id); |
| 77 | + if (!stmt || plugin_id >= mysqlnd_plugin_count()) { |
| 78 | + return NULL; |
| 79 | + } |
| 80 | + DBG_RETURN((void *)((char *)stmt + sizeof(MYSQLND_STMT) + plugin_id * sizeof(void *))); |
| 81 | +} |
| 82 | +/* }}} */ |
| 83 | + |
| 84 | + |
| 85 | +/* {{{ _mysqlnd_plugin_get_plugin_net_data */ |
| 86 | +PHPAPI void ** _mysqlnd_plugin_get_plugin_net_data(const MYSQLND_NET * net, unsigned int plugin_id TSRMLS_DC) |
| 87 | +{ |
| 88 | + DBG_ENTER("_mysqlnd_plugin_get_plugin_net_data"); |
| 89 | + DBG_INF_FMT("plugin_id=%u", plugin_id); |
| 90 | + if (!net || plugin_id >= mysqlnd_plugin_count()) { |
| 91 | + return NULL; |
| 92 | + } |
| 93 | + DBG_RETURN((void *)((char *)net + sizeof(MYSQLND_NET) + plugin_id * sizeof(void *))); |
| 94 | +} |
| 95 | +/* }}} */ |
| 96 | + |
| 97 | + |
| 98 | + |
| 99 | +/* {{{ mysqlnd_conn_get_methods */ |
| 100 | +PHPAPI struct st_mysqlnd_conn_methods * |
| 101 | +mysqlnd_conn_get_methods() |
| 102 | +{ |
| 103 | + return mysqlnd_conn_methods; |
| 104 | +} |
| 105 | +/* }}} */ |
| 106 | + |
| 107 | +/* {{{ mysqlnd_conn_set_methods */ |
| 108 | +PHPAPI void mysqlnd_conn_set_methods(struct st_mysqlnd_conn_methods *methods) |
| 109 | +{ |
| 110 | + mysqlnd_conn_methods = methods; |
| 111 | +} |
| 112 | +/* }}} */ |
| 113 | + |
| 114 | + |
| 115 | +/* {{{ mysqlnd_result_get_methods */ |
| 116 | +PHPAPI struct st_mysqlnd_res_methods * |
| 117 | +mysqlnd_result_get_methods() |
| 118 | +{ |
| 119 | + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res); |
| 120 | +} |
| 121 | +/* }}} */ |
| 122 | + |
| 123 | + |
| 124 | +/* {{{ mysqlnd_result_set_methods */ |
| 125 | +PHPAPI void |
| 126 | +mysqlnd_result_set_methods(struct st_mysqlnd_res_methods * methods) |
| 127 | +{ |
| 128 | + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res) = *methods; |
| 129 | +} |
| 130 | +/* }}} */ |
| 131 | + |
| 132 | + |
| 133 | +/* {{{ mysqlnd_stmt_get_methods */ |
| 134 | +PHPAPI struct st_mysqlnd_stmt_methods * |
| 135 | +mysqlnd_stmt_get_methods() |
| 136 | +{ |
| 137 | + return mysqlnd_stmt_methods; |
| 138 | +} |
| 139 | +/* }}} */ |
| 140 | + |
| 141 | + |
| 142 | +/* {{{ mysqlnd_stmt_set_methods */ |
| 143 | +PHPAPI void |
| 144 | +mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods) |
| 145 | +{ |
| 146 | + mysqlnd_stmt_methods = methods; |
| 147 | +} |
| 148 | +/* }}} */ |
| 149 | + |
| 150 | + |
| 151 | +/* {{{ mysqlnd_protocol_get_methods */ |
| 152 | +PHPAPI struct st_mysqlnd_protocol_methods * |
| 153 | +mysqlnd_protocol_get_methods() |
| 154 | +{ |
| 155 | + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol); |
| 156 | +} |
| 157 | +/* }}} */ |
| 158 | + |
| 159 | + |
| 160 | +/* {{{ mysqlnd_protocol_set_methods */ |
| 161 | +PHPAPI void |
| 162 | +mysqlnd_protocol_set_methods(struct st_mysqlnd_protocol_methods * methods) |
| 163 | +{ |
| 164 | + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol) = *methods; |
| 165 | +} |
| 166 | +/* }}} */ |
| 167 | + |
| 168 | + |
| 169 | +/* {{{ mysqlnd_net_get_methods */ |
| 170 | +PHPAPI struct st_mysqlnd_net_methods * |
| 171 | +mysqlnd_net_get_methods() |
| 172 | +{ |
| 173 | + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net); |
| 174 | +} |
| 175 | +/* }}} */ |
| 176 | + |
| 177 | + |
| 178 | +/* {{{ mysqlnd_net_set_methods */ |
| 179 | +PHPAPI void |
| 180 | +mysqlnd_net_set_methods(struct st_mysqlnd_net_methods * methods) |
| 181 | +{ |
| 182 | + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net) = *methods; |
| 183 | +} |
| 184 | +/* }}} */ |
| 185 | + |
| 186 | + |
| 187 | +/* |
| 188 | + * Local variables: |
| 189 | + * tab-width: 4 |
| 190 | + * c-basic-offset: 4 |
| 191 | + * End: |
| 192 | + * vim600: noet sw=4 ts=4 fdm=marker |
| 193 | + * vim<600: noet sw=4 ts=4 |
| 194 | + */ |
0 commit comments