Patch bug55859.diff for MySQLi related Bug #55859
Patch version 2011-10-06 11:22 UTC
Return to Bug #55859 |
Download this patch
Patch Revisions:
Developer: johannes@php.net
Index: ext/mysqli/mysqli_prop.c
===================================================================
--- ext/mysqli/mysqli_prop.c (revision 317096)
+++ ext/mysqli/mysqli_prop.c (working copy)
@@ -236,7 +236,31 @@
}
/* }}} */
+static int link_stat_read(mysqli_object *obj, zval **retval TSRMLS_DC)
+{
+ MYSQLI_GET_MYSQL(MYSQLI_STATUS_VALID);
+ if (!p) {
+ ZVAL_NULL(*retval);
+ } else {
+ char *stat;
+#ifdef MYSQLI_USE_MYSQLND
+ uint stat_len;
+ if (mysqlnd_stat(p, &stat, &stat_len) == PASS) {
+ ZVAL_STRINGL(*retval, stat, stat_len, 0);
+ }
+#else
+ if ((stat = (char *)mysql_stat(p))) {
+ ZVAL_STRING(*retval, stat, 1);
+ }
+#endif
+ else {
+ ZVAL_FALSE(*retval);
+ }
+ }
+ return SUCCESS;
+}
+
/* link properties */
MYSQLI_MAP_PROPERTY_FUNC_LONG(link_errno_read, mysql_errno, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED), ulong, "%lu")
MYSQLI_MAP_PROPERTY_FUNC_STRING(link_error_read, mysql_error, MYSQLI_GET_MYSQL(MYSQLI_STATUS_INITIALIZED))
@@ -425,6 +449,7 @@
{"server_info", sizeof("server_info") - 1, link_server_info_read, NULL},
{"server_version", sizeof("server_version") - 1, link_server_version_read, NULL},
{"sqlstate", sizeof("sqlstate") - 1, link_sqlstate_read, NULL},
+ {"stat", sizeof("stat") -1, link_stat_read, NULL},
{"protocol_version",sizeof("protocol_version") - 1, link_protocol_version_read, NULL},
{"thread_id", sizeof("thread_id") - 1, link_thread_id_read, NULL},
{"warning_count", sizeof("warning_count") - 1, link_warning_count_read, NULL},
|