Return to mysqlnd_ext_plugin.c CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mysqlnd |
1.1 ! misho 1: /* ! 2: +----------------------------------------------------------------------+ ! 3: | PHP Version 5 | ! 4: +----------------------------------------------------------------------+ ! 5: | Copyright (c) 2006-2012 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_conn_data_methods * mysqlnd_conn_data_methods; ! 30: static struct st_mysqlnd_stmt_methods * mysqlnd_stmt_methods; ! 31: ! 32: /* {{{ _mysqlnd_plugin_get_plugin_connection_data */ ! 33: PHPAPI void ** ! 34: _mysqlnd_plugin_get_plugin_connection_data(const MYSQLND * conn, unsigned int plugin_id TSRMLS_DC) ! 35: { ! 36: DBG_ENTER("_mysqlnd_plugin_get_plugin_connection_data"); ! 37: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 38: if (!conn || plugin_id >= mysqlnd_plugin_count()) { ! 39: return NULL; ! 40: } ! 41: DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND) + plugin_id * sizeof(void *))); ! 42: } ! 43: /* }}} */ ! 44: ! 45: ! 46: /* {{{ _mysqlnd_plugin_get_plugin_connection_data_data */ ! 47: PHPAPI void ** ! 48: _mysqlnd_plugin_get_plugin_connection_data_data(const MYSQLND_CONN_DATA * conn, unsigned int plugin_id TSRMLS_DC) ! 49: { ! 50: DBG_ENTER("_mysqlnd_plugin_get_plugin_connection_data_data"); ! 51: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 52: if (!conn || plugin_id >= mysqlnd_plugin_count()) { ! 53: return NULL; ! 54: } ! 55: DBG_RETURN((void *)((char *)conn + sizeof(MYSQLND_CONN_DATA) + plugin_id * sizeof(void *))); ! 56: } ! 57: /* }}} */ ! 58: ! 59: ! 60: /* {{{ _mysqlnd_plugin_get_plugin_result_data */ ! 61: PHPAPI void ** _mysqlnd_plugin_get_plugin_result_data(const MYSQLND_RES * result, unsigned int plugin_id TSRMLS_DC) ! 62: { ! 63: DBG_ENTER("_mysqlnd_plugin_get_plugin_result_data"); ! 64: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 65: if (!result || plugin_id >= mysqlnd_plugin_count()) { ! 66: return NULL; ! 67: } ! 68: DBG_RETURN((void *)((char *)result + sizeof(MYSQLND_RES) + plugin_id * sizeof(void *))); ! 69: } ! 70: /* }}} */ ! 71: ! 72: ! 73: /* {{{ _mysqlnd_plugin_get_plugin_protocol_data */ ! 74: PHPAPI void ** ! 75: _mysqlnd_plugin_get_plugin_protocol_data(const MYSQLND_PROTOCOL * protocol, unsigned int plugin_id TSRMLS_DC) ! 76: { ! 77: DBG_ENTER("_mysqlnd_plugin_get_plugin_protocol_data"); ! 78: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 79: if (!protocol || plugin_id >= mysqlnd_plugin_count()) { ! 80: return NULL; ! 81: } ! 82: DBG_RETURN((void *)((char *)protocol + sizeof(MYSQLND_PROTOCOL) + plugin_id * sizeof(void *))); ! 83: } ! 84: /* }}} */ ! 85: ! 86: ! 87: /* {{{ _mysqlnd_plugin_get_plugin_stmt_data */ ! 88: PHPAPI void ** _mysqlnd_plugin_get_plugin_stmt_data(const MYSQLND_STMT * stmt, unsigned int plugin_id TSRMLS_DC) ! 89: { ! 90: DBG_ENTER("_mysqlnd_plugin_get_plugin_stmt_data"); ! 91: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 92: if (!stmt || plugin_id >= mysqlnd_plugin_count()) { ! 93: return NULL; ! 94: } ! 95: DBG_RETURN((void *)((char *)stmt + sizeof(MYSQLND_STMT) + plugin_id * sizeof(void *))); ! 96: } ! 97: /* }}} */ ! 98: ! 99: ! 100: /* {{{ _mysqlnd_plugin_get_plugin_net_data */ ! 101: PHPAPI void ** _mysqlnd_plugin_get_plugin_net_data(const MYSQLND_NET * net, unsigned int plugin_id TSRMLS_DC) ! 102: { ! 103: DBG_ENTER("_mysqlnd_plugin_get_plugin_net_data"); ! 104: DBG_INF_FMT("plugin_id=%u", plugin_id); ! 105: if (!net || plugin_id >= mysqlnd_plugin_count()) { ! 106: return NULL; ! 107: } ! 108: DBG_RETURN((void *)((char *)net + sizeof(MYSQLND_NET) + plugin_id * sizeof(void *))); ! 109: } ! 110: /* }}} */ ! 111: ! 112: ! 113: ! 114: /* {{{ mysqlnd_conn_get_methods */ ! 115: PHPAPI struct st_mysqlnd_conn_methods * ! 116: mysqlnd_conn_get_methods() ! 117: { ! 118: return mysqlnd_conn_methods; ! 119: } ! 120: /* }}} */ ! 121: ! 122: /* {{{ mysqlnd_conn_set_methods */ ! 123: PHPAPI void mysqlnd_conn_set_methods(struct st_mysqlnd_conn_methods *methods) ! 124: { ! 125: mysqlnd_conn_methods = methods; ! 126: } ! 127: /* }}} */ ! 128: ! 129: ! 130: /* {{{ mysqlnd_conn_get_methods */ ! 131: PHPAPI struct st_mysqlnd_conn_data_methods * ! 132: mysqlnd_conn_data_get_methods() ! 133: { ! 134: return mysqlnd_conn_data_methods; ! 135: } ! 136: /* }}} */ ! 137: ! 138: /* {{{ mysqlnd_conn_set_methods */ ! 139: PHPAPI void mysqlnd_conn_data_set_methods(struct st_mysqlnd_conn_data_methods * methods) ! 140: { ! 141: mysqlnd_conn_data_methods = methods; ! 142: } ! 143: /* }}} */ ! 144: ! 145: ! 146: /* {{{ mysqlnd_result_get_methods */ ! 147: PHPAPI struct st_mysqlnd_res_methods * ! 148: mysqlnd_result_get_methods() ! 149: { ! 150: return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res); ! 151: } ! 152: /* }}} */ ! 153: ! 154: ! 155: /* {{{ mysqlnd_result_set_methods */ ! 156: PHPAPI void ! 157: mysqlnd_result_set_methods(struct st_mysqlnd_res_methods * methods) ! 158: { ! 159: MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res) = *methods; ! 160: } ! 161: /* }}} */ ! 162: ! 163: ! 164: /* {{{ mysqlnd_stmt_get_methods */ ! 165: PHPAPI struct st_mysqlnd_stmt_methods * ! 166: mysqlnd_stmt_get_methods() ! 167: { ! 168: return mysqlnd_stmt_methods; ! 169: } ! 170: /* }}} */ ! 171: ! 172: ! 173: /* {{{ mysqlnd_stmt_set_methods */ ! 174: PHPAPI void ! 175: mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods) ! 176: { ! 177: mysqlnd_stmt_methods = methods; ! 178: } ! 179: /* }}} */ ! 180: ! 181: ! 182: /* {{{ mysqlnd_protocol_get_methods */ ! 183: PHPAPI struct st_mysqlnd_protocol_methods * ! 184: mysqlnd_protocol_get_methods() ! 185: { ! 186: return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol); ! 187: } ! 188: /* }}} */ ! 189: ! 190: ! 191: /* {{{ mysqlnd_protocol_set_methods */ ! 192: PHPAPI void ! 193: mysqlnd_protocol_set_methods(struct st_mysqlnd_protocol_methods * methods) ! 194: { ! 195: MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol) = *methods; ! 196: } ! 197: /* }}} */ ! 198: ! 199: ! 200: /* {{{ mysqlnd_net_get_methods */ ! 201: PHPAPI struct st_mysqlnd_net_methods * ! 202: mysqlnd_net_get_methods() ! 203: { ! 204: return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net); ! 205: } ! 206: /* }}} */ ! 207: ! 208: ! 209: /* {{{ mysqlnd_net_set_methods */ ! 210: PHPAPI void ! 211: mysqlnd_net_set_methods(struct st_mysqlnd_net_methods * methods) ! 212: { ! 213: MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net) = *methods; ! 214: } ! 215: /* }}} */ ! 216: ! 217: ! 218: ! 219: /* ! 220: * Local variables: ! 221: * tab-width: 4 ! 222: * c-basic-offset: 4 ! 223: * End: ! 224: * vim600: noet sw=4 ts=4 fdm=marker ! 225: * vim<600: noet sw=4 ts=4 ! 226: */