xref: /PHP-7.3/ext/mysqli/mysqli_prop.c (revision 1c393e95)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 7                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2018 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   | Author: Georg Richter <georg@php.net>                                |
16   |         Andrey Hristov <andrey@php.net>                              |
17   +----------------------------------------------------------------------+
18 */
19 
20 #ifdef HAVE_CONFIG_H
21 #include "config.h"
22 #endif
23 
24 #include <signal.h>
25 
26 #include "php.h"
27 #include "php_ini.h"
28 #include "ext/standard/info.h"
29 #include "php_mysqli_structs.h"
30 #include "mysqli_priv.h"
31 
32 #define CHECK_STATUS(value) \
33 	if (!obj->ptr || ((MYSQLI_RESOURCE *)obj->ptr)->status < value ) { \
34 		php_error_docref(NULL, E_WARNING, "Property access is not allowed yet"); \
35 		ZVAL_FALSE(retval); \
36 		return retval; \
37 	} \
38 
39 #define MYSQLI_GET_MYSQL(statusval) \
40 MYSQL *p; \
41 if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \
42 	php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
43 	ZVAL_FALSE(retval);\
44 	return retval; \
45 } else { \
46 	CHECK_STATUS(statusval);\
47     p = (MYSQL *)((MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->mysql;\
48 }
49 
50 #define MYSQLI_GET_RESULT(statusval) \
51 MYSQL_RES *p; \
52 if (!obj->ptr) { \
53 	php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
54 	ZVAL_NULL(retval);\
55 	return retval; \
56 } else { \
57 	CHECK_STATUS(statusval);\
58 	p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr; \
59 }
60 
61 
62 #define MYSQLI_GET_STMT(statusval) \
63 MYSQL_STMT *p; \
64 if (!obj->ptr) { \
65 	php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name));\
66 	ZVAL_NULL(retval);\
67 	return retval; \
68 } else { \
69 	CHECK_STATUS(statusval);\
70 	p = (MYSQL_STMT *)((MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr)->stmt;\
71 }
72 
73 #define MYSQLI_MAP_PROPERTY_FUNC_LONG( __func, __int_func, __get_type, __ret_type, __ret_type_sprint_mod)\
74 static zval *__func(mysqli_object *obj, zval *retval) \
75 {\
76 	__ret_type l;\
77 	__get_type;\
78 	if (!p) {\
79 		ZVAL_NULL(retval);\
80 	} else {\
81 		l = (__ret_type)__int_func(p);\
82 		if (l < ZEND_LONG_MAX) {\
83 			ZVAL_LONG(retval, (zend_long) l);\
84 		} else { \
85 			ZVAL_NEW_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
86 		} \
87 	}\
88 	return retval;\
89 }
90 
91 #define MYSQLI_MAP_PROPERTY_FUNC_STRING(__func, __int_func, __get_type)\
92 static zval *__func(mysqli_object *obj, zval *retval)\
93 {\
94 	char *c;\
95 	__get_type;\
96 	if (!p) {\
97 		ZVAL_NULL(retval);\
98 	} else {\
99 		c = (char *)__int_func(p);\
100 		if (!c) {\
101 			ZVAL_NULL(retval);\
102 		} else {\
103 			ZVAL_STRING(retval, c);\
104 		}\
105 	}\
106 	return retval; \
107 }
108 
109 /* {{{ property link_client_version_read */
link_client_version_read(mysqli_object * obj,zval * retval)110 static zval *link_client_version_read(mysqli_object *obj, zval *retval)
111 {
112 	ZVAL_LONG(retval, MYSQL_VERSION_ID);
113 	return retval;
114 }
115 /* }}} */
116 
117 /* {{{ property link_client_info_read */
link_client_info_read(mysqli_object * obj,zval * retval)118 static zval *link_client_info_read(mysqli_object *obj, zval *retval)
119 {
120 	CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
121 	ZVAL_STRING(retval, MYSQL_SERVER_VERSION);
122 	return retval;
123 }
124 /* }}} */
125 
126 /* {{{ property link_connect_errno_read */
link_connect_errno_read(mysqli_object * obj,zval * retval)127 static zval *link_connect_errno_read(mysqli_object *obj, zval *retval)
128 {
129 	ZVAL_LONG(retval, (zend_long)MyG(error_no));
130 	return retval;
131 }
132 /* }}} */
133 
134 /* {{{ property link_connect_error_read */
link_connect_error_read(mysqli_object * obj,zval * retval)135 static zval *link_connect_error_read(mysqli_object *obj, zval *retval)
136 {
137 	if (MyG(error_msg)) {
138 		ZVAL_STRING(retval, MyG(error_msg));
139 	} else {
140 		ZVAL_NULL(retval);
141 	}
142 	return retval;
143 }
144 /* }}} */
145 
146 /* {{{ property link_affected_rows_read */
link_affected_rows_read(mysqli_object * obj,zval * retval)147 static zval *link_affected_rows_read(mysqli_object *obj, zval *retval)
148 {
149 	MY_MYSQL *mysql;
150 	my_ulonglong rc;
151 
152 	CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
153 
154  	mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
155 
156 	if (!mysql) {
157 		ZVAL_NULL(retval);
158 	} else {
159 		CHECK_STATUS(MYSQLI_STATUS_VALID);
160 
161 		rc = mysql_affected_rows(mysql->mysql);
162 
163 		if (rc == (my_ulonglong) -1) {
164 			ZVAL_LONG(retval, -1);
165 			return retval;
166 		}
167 
168 		if (rc < ZEND_LONG_MAX) {
169 			ZVAL_LONG(retval, (zend_long) rc);
170 		} else {
171 			ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
172 		}
173 	}
174 	return retval;
175 }
176 /* }}} */
177 
178 /* {{{ property link_error_list_read */
link_error_list_read(mysqli_object * obj,zval * retval)179 static zval *link_error_list_read(mysqli_object *obj, zval *retval)
180 {
181 	MY_MYSQL *mysql;
182 
183 	CHECK_STATUS(MYSQLI_STATUS_VALID);
184 
185  	mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
186 
187 	if (mysql) {
188 		array_init(retval);
189 #if defined(MYSQLI_USE_MYSQLND)
190 		if (1) {
191 			MYSQLND_ERROR_LIST_ELEMENT * message;
192 			zend_llist_position pos;
193 			for (message = (MYSQLND_ERROR_LIST_ELEMENT *) zend_llist_get_first_ex(&mysql->mysql->data->error_info->error_list, &pos);
194 				 message;
195 				 message = (MYSQLND_ERROR_LIST_ELEMENT *) zend_llist_get_next_ex(&mysql->mysql->data->error_info->error_list, &pos))
196 			{
197 				zval single_error;
198 				array_init(&single_error);
199 				add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
200 				add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
201 				add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
202 				add_next_index_zval(retval, &single_error);
203 			}
204 		}
205 #else
206 		if (mysql_errno(mysql->mysql)) {
207 			zval single_error;
208 			array_init(&single_error);
209 			add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_errno(mysql->mysql));
210 			add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_sqlstate(mysql->mysql));
211 			add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_error(mysql->mysql));
212 			add_next_index_zval(retval, &single_error);
213 		}
214 #endif
215 	} else {
216 		ZVAL_EMPTY_ARRAY(retval);
217 	}
218 
219 	return retval;
220 }
221 /* }}} */
222 
223 /* link properties */
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read,mysql_errno,MYSQLI_GET_MYSQL (MYSQLI_STATUS_INITIALIZED),zend_ulong,ZEND_ULONG_FMT)224 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
225 MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED))
226 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_field_count_read, mysql_field_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
227 MYSQLI_MAP_PROPERTY_FUNC_STRING(link_host_info_read, mysql_get_host_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
228 MYSQLI_MAP_PROPERTY_FUNC_STRING(link_info_read, mysql_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
229 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_insert_id_read, mysql_insert_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
230 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_protocol_version_read, mysql_get_proto_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
231 MYSQLI_MAP_PROPERTY_FUNC_STRING(link_server_info_read, mysql_get_server_info, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
232 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_server_version_read, mysql_get_server_version, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
233 MYSQLI_MAP_PROPERTY_FUNC_STRING(link_sqlstate_read, mysql_sqlstate, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID))
234 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_thread_id_read, mysql_thread_id, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
235 MYSQLI_MAP_PROPERTY_FUNC_LONG(link_warning_count_read, mysql_warning_count, MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
236 
237 /* {{{ property link_stat_read */
238 static zval *link_stat_read(mysqli_object *obj, zval *retval)
239 {
240 	MY_MYSQL *mysql;
241 
242 	ZVAL_NULL(retval);
243 
244 #if defined(MYSQLI_USE_MYSQLND)
245 	CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
246 #else
247 	CHECK_STATUS(MYSQLI_STATUS_VALID);
248 #endif
249 
250  	mysql = (MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
251 
252 	if (mysql) {
253 #if defined(MYSQLI_USE_MYSQLND)
254 		zend_string * stat_msg;
255 		if (mysqlnd_stat(mysql->mysql, &stat_msg) == PASS) {
256 			ZVAL_STR(retval, stat_msg);
257 		}
258 #else
259 		char * stat_msg;
260 		if ((stat_msg = (char *)mysql_stat(mysql->mysql))) {
261 			ZVAL_STRING(retval, stat_msg);
262 		}
263 #endif
264 	}
265 	return retval;
266 }
267 /* }}} */
268 
269 /* result properties */
270 
271 /* {{{ property result_type_read */
result_type_read(mysqli_object * obj,zval * retval)272 static zval *result_type_read(mysqli_object *obj, zval *retval)
273 {
274 	MYSQL_RES *p;
275 
276 	CHECK_STATUS(MYSQLI_STATUS_VALID);
277  	p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
278 
279 	if (!p) {
280 		ZVAL_NULL(retval);
281 	} else {
282 		ZVAL_LONG(retval, mysqli_result_is_unbuffered(p) ? MYSQLI_USE_RESULT:MYSQLI_STORE_RESULT);
283 	}
284 	return retval;
285 }
286 /* }}} */
287 
288 /* {{{ property result_lengths_read */
result_lengths_read(mysqli_object * obj,zval * retval)289 static zval *result_lengths_read(mysqli_object *obj, zval *retval)
290 {
291 	MYSQL_RES *p;
292 #if defined(MYSQLI_USE_MYSQLND)
293 	const size_t *ret;
294 #else
295 	const zend_ulong *ret;
296 #endif
297 	uint32_t field_count;
298 
299 	CHECK_STATUS(MYSQLI_STATUS_VALID);
300 	p = (MYSQL_RES *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
301 	field_count = mysql_num_fields(p);
302 	if (!p || !field_count || !(ret = mysql_fetch_lengths(p))) {
303 		ZVAL_NULL(retval);
304 	} else {
305 		zend_ulong i;
306 
307 		array_init(retval);
308 
309 		for (i = 0; i < field_count; i++) {
310 			add_index_long(retval, i, ret[i]);
311 		}
312 	}
313 	return retval;
314 }
315 /* }}} */
316 
MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read,mysql_field_tell,MYSQLI_GET_RESULT (MYSQLI_STATUS_VALID),zend_ulong,ZEND_ULONG_FMT)317 MYSQLI_MAP_PROPERTY_FUNC_LONG(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
318 MYSQLI_MAP_PROPERTY_FUNC_LONG(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
319 MYSQLI_MAP_PROPERTY_FUNC_LONG(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
320 
321 /* statement properties */
322 
323 /* {{{ property stmt_id_read */
324 static zval *stmt_id_read(mysqli_object *obj, zval *retval)
325 {
326 	MY_STMT *p;
327 
328 	CHECK_STATUS(MYSQLI_STATUS_VALID);
329 
330  	p = (MY_STMT*)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
331 
332 	if (!p) {
333 		ZVAL_NULL(retval);
334 	} else {
335 		ZVAL_LONG(retval, mysqli_stmt_get_id(p->stmt));
336 	}
337 	return retval;
338 }
339 /* }}} */
340 
341 /* {{{ property stmt_affected_rows_read */
stmt_affected_rows_read(mysqli_object * obj,zval * retval)342 static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval)
343 {
344 	MY_STMT *p;
345 	my_ulonglong rc;
346 
347 	CHECK_STATUS(MYSQLI_STATUS_VALID);
348 
349  	p = (MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
350 
351 	if (!p) {
352 		ZVAL_NULL(retval);
353 	} else {
354 		rc = mysql_stmt_affected_rows(p->stmt);
355 
356 		if (rc == (my_ulonglong) -1) {
357 			ZVAL_LONG(retval, -1);
358 			return retval;
359 		}
360 
361 		if (rc < ZEND_LONG_MAX) {
362 			ZVAL_LONG(retval, (zend_long) rc);
363 		} else {
364 			ZVAL_NEW_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
365 		}
366 	}
367 	return retval;
368 }
369 /* }}} */
370 
371 /* {{{ property stmt_error_list_read */
stmt_error_list_read(mysqli_object * obj,zval * retval)372 static zval *stmt_error_list_read(mysqli_object *obj, zval *retval)
373 {
374 	MY_STMT * stmt;
375 
376 	CHECK_STATUS(MYSQLI_STATUS_INITIALIZED);
377 
378  	stmt = (MY_STMT *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr;
379 	if (stmt && stmt->stmt) {
380 		array_init(retval);
381 #if defined(MYSQLI_USE_MYSQLND)
382 		if (stmt->stmt->data && stmt->stmt->data->error_info) {
383 			MYSQLND_ERROR_LIST_ELEMENT * message;
384 			zend_llist_position pos;
385 			for (message = (MYSQLND_ERROR_LIST_ELEMENT *) zend_llist_get_first_ex(&stmt->stmt->data->error_info->error_list, &pos);
386 				 message;
387 				 message = (MYSQLND_ERROR_LIST_ELEMENT *) zend_llist_get_next_ex(&stmt->stmt->data->error_info->error_list, &pos))
388 			{
389 				zval single_error;
390 				array_init(&single_error);
391 				add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, message->error_no);
392 				add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, message->sqlstate);
393 				add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, message->error);
394 				add_next_index_zval(retval, &single_error);
395 			}
396 		}
397 #else
398 		if (mysql_stmt_errno(stmt->stmt)) {
399 			zval single_error;
400 			array_init(&single_error);
401 			add_assoc_long_ex(&single_error, "errno", sizeof("errno") - 1, mysql_stmt_errno(stmt->stmt));
402 			add_assoc_string_ex(&single_error, "sqlstate", sizeof("sqlstate") - 1, mysql_stmt_sqlstate(stmt->stmt));
403 			add_assoc_string_ex(&single_error, "error", sizeof("error") - 1, mysql_stmt_error(stmt->stmt));
404 			add_next_index_zval(retval, &single_error);
405 		}
406 #endif
407 	} else {
408 		ZVAL_EMPTY_ARRAY(retval);
409 	}
410 	return retval;
411 }
412 /* }}} */
413 
414 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
415 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
416 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
417 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), zend_ulong, ZEND_ULONG_FMT)
418 MYSQLI_MAP_PROPERTY_FUNC_LONG(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), zend_ulong, ZEND_ULONG_FMT)
419 MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
420 MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
421 
422 /* }}} */
423 const mysqli_property_entry mysqli_link_property_entries[] = {
424 	{"affected_rows", 	sizeof("affected_rows") - 1,	link_affected_rows_read, NULL},
425 	{"client_info", 	sizeof("client_info") - 1,		link_client_info_read, NULL},
426 	{"client_version",	sizeof("client_version") - 1,	link_client_version_read, NULL},
427 	{"connect_errno",	sizeof("connect_errno") - 1,	link_connect_errno_read, NULL},
428 	{"connect_error",	sizeof("connect_error") - 1,	link_connect_error_read, NULL},
429 	{"errno",			sizeof("errno") - 1,			link_errno_read, NULL},
430 	{"error",			sizeof("error") - 1,			link_error_read, NULL},
431 	{"error_list",		sizeof("error_list") - 1,		link_error_list_read, NULL},
432 	{"field_count",		sizeof("field_count") - 1,		link_field_count_read, NULL},
433 	{"host_info",		sizeof("host_info") - 1,		link_host_info_read, NULL},
434 	{"info",			sizeof("info") - 1,				link_info_read, NULL},
435 	{"insert_id",		sizeof("insert_id") - 1,		link_insert_id_read, NULL},
436 	{"server_info",		sizeof("server_info") - 1,		link_server_info_read, NULL},
437 	{"server_version",	sizeof("server_version") - 1,	link_server_version_read, NULL},
438 	{"stat",			sizeof("stat") - 1,				link_stat_read, NULL},
439 	{"sqlstate",		sizeof("sqlstate") - 1,			link_sqlstate_read, NULL},
440 	{"protocol_version",sizeof("protocol_version") - 1,	link_protocol_version_read, NULL},
441 	{"thread_id",		sizeof("thread_id") - 1, 		link_thread_id_read, NULL},
442 	{"warning_count",	sizeof("warning_count") - 1, 	link_warning_count_read, NULL},
443 	{NULL, 0, NULL, NULL}
444 };
445 
446 
447 const mysqli_property_entry mysqli_result_property_entries[] = {
448 	{"current_field",sizeof("current_field")-1,	result_current_field_read, NULL},
449 	{"field_count", sizeof("field_count") - 1,	result_field_count_read, NULL},
450 	{"lengths", 	sizeof("lengths") - 1,		result_lengths_read, NULL},
451 	{"num_rows", 	sizeof("num_rows") - 1,		result_num_rows_read, NULL},
452 	{"type", 		sizeof("type") - 1,			result_type_read, NULL},
453 	{NULL, 0, NULL, NULL}
454 };
455 
456 const mysqli_property_entry mysqli_stmt_property_entries[] = {
457 	{"affected_rows", sizeof("affected_rows")-1,stmt_affected_rows_read, NULL},
458 	{"insert_id",	sizeof("insert_id") - 1, 	stmt_insert_id_read, NULL},
459 	{"num_rows",	sizeof("num_rows") - 1, 	stmt_num_rows_read, NULL},
460 	{"param_count", sizeof("param_count") - 1,	stmt_param_count_read, NULL},
461 	{"field_count", sizeof("field_count") - 1,	stmt_field_count_read, NULL},
462 	{"errno",		sizeof("errno") - 1,		stmt_errno_read, NULL},
463 	{"error",		sizeof("error") - 1, 		stmt_error_read, NULL},
464 	{"error_list",	sizeof("error_list") - 1, 	stmt_error_list_read, NULL},
465 	{"sqlstate",	sizeof("sqlstate") - 1,		stmt_sqlstate_read, NULL},
466 	{"id",			sizeof("id") - 1,			stmt_id_read, NULL},
467 	{NULL, 0, NULL, NULL}
468 };
469 
470 /*
471  * Local variables:
472  * tab-width: 4
473  * c-basic-offset: 4
474  * End:
475  * vim600: noet sw=4 ts=4 fdm=marker
476  * vim<600: noet sw=4 ts=4
477  */
478