Skip to content

Commit 7472c08

Browse files
committed
add files that weren't committed with the previous commit
1 parent 1398138 commit 7472c08

File tree

3 files changed

+426
-0
lines changed

3 files changed

+426
-0
lines changed

ext/mysqlnd/mysqlnd_driver.c

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 317989 2011-10-10 20:49:28Z andrey $ */
22+
#include "php.h"
23+
#include "mysqlnd.h"
24+
#include "mysqlnd_wireprotocol.h"
25+
#include "mysqlnd_priv.h"
26+
#include "mysqlnd_result.h"
27+
#include "mysqlnd_statistics.h"
28+
#include "mysqlnd_charset.h"
29+
#include "mysqlnd_debug.h"
30+
#include "mysqlnd_reverse_api.h"
31+
#include "mysqlnd_ext_plugin.h"
32+
33+
static zend_bool mysqlnd_library_initted = FALSE;
34+
35+
static struct st_mysqlnd_plugin_core mysqlnd_plugin_core =
36+
{
37+
{
38+
MYSQLND_PLUGIN_API_VERSION,
39+
"mysqlnd",
40+
MYSQLND_VERSION_ID,
41+
MYSQLND_VERSION,
42+
"PHP License 3.01",
43+
"Andrey Hristov <andrey@mysql.com>, Ulf Wendel <uwendel@mysql.com>, Georg Richter <georg@mysql.com>",
44+
{
45+
NULL, /* will be filled later */
46+
mysqlnd_stats_values_names,
47+
},
48+
{
49+
NULL /* plugin shutdown */
50+
}
51+
}
52+
};
53+
54+
55+
/* {{{ mysqlnd_library_end */
56+
PHPAPI void mysqlnd_library_end(TSRMLS_D)
57+
{
58+
if (mysqlnd_library_initted == TRUE) {
59+
mysqlnd_plugin_subsystem_end(TSRMLS_C);
60+
mysqlnd_stats_end(mysqlnd_global_stats);
61+
mysqlnd_global_stats = NULL;
62+
mysqlnd_library_initted = FALSE;
63+
mysqlnd_reverse_api_end(TSRMLS_C);
64+
}
65+
}
66+
/* }}} */
67+
68+
69+
/* {{{ mysqlnd_library_init */
70+
PHPAPI void mysqlnd_library_init(TSRMLS_D)
71+
{
72+
if (mysqlnd_library_initted == FALSE) {
73+
mysqlnd_library_initted = TRUE;
74+
mysqlnd_conn_set_methods(&MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_conn));
75+
_mysqlnd_init_ps_subsystem();
76+
/* Should be calloc, as mnd_calloc will reference LOCK_access*/
77+
mysqlnd_stats_init(&mysqlnd_global_stats, STAT_LAST);
78+
mysqlnd_plugin_subsystem_init(TSRMLS_C);
79+
{
80+
mysqlnd_plugin_core.plugin_header.plugin_stats.values = mysqlnd_global_stats;
81+
mysqlnd_plugin_register_ex((struct st_mysqlnd_plugin_header *) &mysqlnd_plugin_core TSRMLS_CC);
82+
}
83+
mysqlnd_example_plugin_register(TSRMLS_C);
84+
mysqlnd_debug_trace_plugin_register(TSRMLS_C);
85+
mysqlnd_register_builtin_authentication_plugins(TSRMLS_C);
86+
87+
mysqlnd_reverse_api_init(TSRMLS_C);
88+
}
89+
}
90+
/* }}} */
91+
92+
93+
/*
94+
* Local variables:
95+
* tab-width: 4
96+
* c-basic-offset: 4
97+
* End:
98+
* vim600: noet sw=4 ts=4 fdm=marker
99+
* vim<600: noet sw=4 ts=4
100+
*/

ext/mysqlnd/mysqlnd_ext_plugin.c

+194
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
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

Comments
 (0)