From: Andrey Hristov Date: Fri, 21 Oct 2011 15:29:43 +0000 (+0000) Subject: add files that weren't committed with the previous commit X-Git-Tag: php-5.5.0alpha1~997 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7472c081b7eef2d263d1839346a960095c407ba8;p=php add files that weren't committed with the previous commit --- diff --git a/ext/mysqlnd/mysqlnd_driver.c b/ext/mysqlnd/mysqlnd_driver.c new file mode 100644 index 0000000000..c2acf89d60 --- /dev/null +++ b/ext/mysqlnd/mysqlnd_driver.c @@ -0,0 +1,100 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2011 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andrey Hristov | + | Ulf Wendel | + | Georg Richter | + +----------------------------------------------------------------------+ +*/ + +/* $Id: mysqlnd.c 317989 2011-10-10 20:49:28Z 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" +#include "mysqlnd_reverse_api.h" +#include "mysqlnd_ext_plugin.h" + +static zend_bool mysqlnd_library_initted = FALSE; + +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 , Ulf Wendel , Georg Richter ", + { + NULL, /* will be filled later */ + mysqlnd_stats_values_names, + }, + { + NULL /* plugin shutdown */ + } + } +}; + + +/* {{{ 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_library_init */ +PHPAPI void mysqlnd_library_init(TSRMLS_D) +{ + if (mysqlnd_library_initted == FALSE) { + mysqlnd_library_initted = TRUE; + mysqlnd_conn_set_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); + } +} +/* }}} */ + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.c b/ext/mysqlnd/mysqlnd_ext_plugin.c new file mode 100644 index 0000000000..545ab61ab7 --- /dev/null +++ b/ext/mysqlnd/mysqlnd_ext_plugin.c @@ -0,0 +1,194 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2011 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andrey Hristov | + | Ulf Wendel | + | Georg Richter | + +----------------------------------------------------------------------+ +*/ + +/* $Id: mysqlnd.c 318221 2011-10-19 15:04:12Z andrey $ */ +#include "php.h" +#include "mysqlnd.h" +#include "mysqlnd_priv.h" +#include "mysqlnd_result.h" +#include "mysqlnd_debug.h" + +static struct st_mysqlnd_conn_methods * mysqlnd_conn_methods; +static struct st_mysqlnd_stmt_methods * mysqlnd_stmt_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 *))); +} +/* }}} */ + + +/* {{{ _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_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_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_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_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_result_get_methods */ +PHPAPI struct st_mysqlnd_res_methods * +mysqlnd_result_get_methods() +{ + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res); +} +/* }}} */ + + +/* {{{ mysqlnd_result_set_methods */ +PHPAPI void +mysqlnd_result_set_methods(struct st_mysqlnd_res_methods * methods) +{ + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_res) = *methods; +} +/* }}} */ + + +/* {{{ mysqlnd_stmt_get_methods */ +PHPAPI struct st_mysqlnd_stmt_methods * +mysqlnd_stmt_get_methods() +{ + return mysqlnd_stmt_methods; +} +/* }}} */ + + +/* {{{ mysqlnd_stmt_set_methods */ +PHPAPI void +mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods *methods) +{ + mysqlnd_stmt_methods = methods; +} +/* }}} */ + + +/* {{{ mysqlnd_protocol_get_methods */ +PHPAPI struct st_mysqlnd_protocol_methods * +mysqlnd_protocol_get_methods() +{ + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol); +} +/* }}} */ + + +/* {{{ mysqlnd_protocol_set_methods */ +PHPAPI void +mysqlnd_protocol_set_methods(struct st_mysqlnd_protocol_methods * methods) +{ + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_protocol) = *methods; +} +/* }}} */ + + +/* {{{ mysqlnd_net_get_methods */ +PHPAPI struct st_mysqlnd_net_methods * +mysqlnd_net_get_methods() +{ + return &MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net); +} +/* }}} */ + + +/* {{{ mysqlnd_net_set_methods */ +PHPAPI void +mysqlnd_net_set_methods(struct st_mysqlnd_net_methods * methods) +{ + MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_net) = *methods; +} +/* }}} */ + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ diff --git a/ext/mysqlnd/mysqlnd_ext_plugin.h b/ext/mysqlnd/mysqlnd_ext_plugin.h new file mode 100644 index 0000000000..8a7a695672 --- /dev/null +++ b/ext/mysqlnd/mysqlnd_ext_plugin.h @@ -0,0 +1,132 @@ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2011 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andrey Hristov | + | Ulf Wendel | + | Georg Richter | + +----------------------------------------------------------------------+ +*/ +/* $Id: mysqlnd.h 318221 2011-10-19 15:04:12Z andrey $ */ + +#ifndef MYSQLND_EXT_PLUGIN_H +#define MYSQLND_EXT_PLUGIN_H + +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_res_methods * mysqlnd_result_get_methods(); +PHPAPI void mysqlnd_result_set_methods(struct st_mysqlnd_res_methods * methods); + +PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods(); +PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods * methods); + +PHPAPI struct st_mysqlnd_protocol_methods * mysqlnd_protocol_get_methods(); +PHPAPI void mysqlnd_protocol_set_methods(struct st_mysqlnd_protocol_methods * methods); + +PHPAPI struct st_mysqlnd_net_methods * mysqlnd_net_get_methods(); +PHPAPI void mysqlnd_net_set_methods(struct st_mysqlnd_net_methods * methods); + + +#endif /* MYSQLND_EXT_PLUGIN_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */ +/* + +----------------------------------------------------------------------+ + | PHP Version 5 | + +----------------------------------------------------------------------+ + | Copyright (c) 2006-2011 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andrey Hristov | + | Ulf Wendel | + | Georg Richter | + +----------------------------------------------------------------------+ +*/ +/* $Id: mysqlnd.h 318221 2011-10-19 15:04:12Z andrey $ */ + +#ifndef MYSQLND_EXT_PLUGIN_H +#define MYSQLND_EXT_PLUGIN_H + +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_res_methods * mysqlnd_result_get_methods(); +PHPAPI void mysqlnd_result_set_methods(struct st_mysqlnd_res_methods * methods); + +PHPAPI struct st_mysqlnd_stmt_methods * mysqlnd_stmt_get_methods(); +PHPAPI void mysqlnd_stmt_set_methods(struct st_mysqlnd_stmt_methods * methods); + +PHPAPI struct st_mysqlnd_protocol_methods * mysqlnd_protocol_get_methods(); +PHPAPI void mysqlnd_protocol_set_methods(struct st_mysqlnd_protocol_methods * methods); + +PHPAPI struct st_mysqlnd_net_methods * mysqlnd_net_get_methods(); +PHPAPI void mysqlnd_net_set_methods(struct st_mysqlnd_net_methods * methods); + + +#endif /* MYSQLND_EXT_PLUGIN_H */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw=4 ts=4 fdm=marker + * vim<600: noet sw=4 ts=4 + */