[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] =?utf-8?q?svn:_/pecl/mysqlnd=5Fuh/trunk/_mysqlnd=5Fuh=5Fclass=5Fconn=5Fdata.c_mysqlnd=5Fu
From: Ulf_Wendel <uw () php ! net>
Date: 2013-12-19 10:29:46
Message-ID: svn-uw-1387448986-332471-992039922 () svn ! php ! net
[Download RAW message or body]
uw Thu, 19 Dec 2013 10:29:46 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=332471
Log:
ConnData::getServerStatus(), there may be no userland standard mysql API call that invokes it.
Changed paths:
U pecl/mysqlnd_uh/trunk/mysqlnd_uh_class_conn_data.c
U pecl/mysqlnd_uh/trunk/mysqlnd_uh_classes.h
U pecl/mysqlnd_uh/trunk/mysqlnd_uh_hooks_conn_data.c
A pecl/mysqlnd_uh/trunk/tests/mysqlnd_uh_class_conn_data_m_get_server_status.phpt
["svn-diffs-332471.txt" (text/x-diff)]
Modified: pecl/mysqlnd_uh/trunk/mysqlnd_uh_class_conn_data.c
===================================================================
--- pecl/mysqlnd_uh/trunk/mysqlnd_uh_class_conn_data.c 2013-12-19 10:01:14 UTC (rev \
332470)
+++ pecl/mysqlnd_uh/trunk/mysqlnd_uh_class_conn_data.c 2013-12-19 10:29:46 UTC (rev \
332471) @@ -552,8 +552,8 @@
CLASS_CONN_PHP_METHOD_ONE_ARG_CONN_RET_UINT64(get_affected_rows, getAffectedRows, \
const MYSQLND_CONN_DATA * const) \
CLASS_CONN_PHP_METHOD_ONE_ARG_CONN_RET_UINT(get_warning_count, getWarningCount, const \
MYSQLND_CONN_DATA * const) \
CLASS_CONN_PHP_METHOD_ONE_ARG_CONN_RET_UINT(get_field_count, getFieldCount, const \
MYSQLND_CONN_DATA * const) \
+CLASS_CONN_PHP_METHOD_ONE_ARG_CONN_RET_UINT(get_server_status, getServerStatus, \
const MYSQLND_CONN_DATA * const)
-
/* {{{ */
PHP_METHOD(MYSQLND_UH_CLASS_CONN_DATA_NAME, setServerOption)
{
@@ -873,6 +873,7 @@
METHOD_ARG_INFO_CONN_ONLY_ARG(getAffectedRows_arginfo)
METHOD_ARG_INFO_CONN_ONLY_ARG(getWarningCount_arginfo)
METHOD_ARG_INFO_CONN_ONLY_ARG(getFieldCount_arginfo)
+METHOD_ARG_INFO_CONN_ONLY_ARG(getServerStatus_arginfo)
METHOD_ARG_INFO_BEGIN_W_CONN(setServerOption_arginfo)
ZEND_ARG_INFO(0, "option")
@@ -960,6 +961,7 @@
PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, getAffectedRows, getAffectedRows_arginfo, \
ZEND_ACC_PUBLIC) PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, getWarningCount, \
getWarningCount_arginfo, ZEND_ACC_PUBLIC) PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, \
getFieldCount, getFieldCount_arginfo, ZEND_ACC_PUBLIC) \
+ PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, getServerStatus, getServerStatus_arginfo, \
ZEND_ACC_PUBLIC) PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, setServerOption, \
setServerOption_arginfo, ZEND_ACC_PUBLIC) PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, \
setClientOption, setClientOption_arginfo, ZEND_ACC_PUBLIC) \
PHP_ME(MYSQLND_UH_CLASS_CONN_DATA_NAME, queryReadResultsetHeader, \
queryReadResultsetHeader_arginfo, ZEND_ACC_PUBLIC)
Modified: pecl/mysqlnd_uh/trunk/mysqlnd_uh_classes.h
===================================================================
--- pecl/mysqlnd_uh/trunk/mysqlnd_uh_classes.h 2013-12-19 10:01:14 UTC (rev 332470)
+++ pecl/mysqlnd_uh/trunk/mysqlnd_uh_classes.h 2013-12-19 10:29:46 UTC (rev 332471)
@@ -50,38 +50,41 @@
A dirty hack for calling methods from C, copied from \
zend_interfaces.h/zend_interfaces.c. Unfortunately Zend does not export those calls \
:-(
*/
-zval* mysqlnd_uh_call_method(zval **object_pp, zend_class_entry *obj_ce, \
zend_function **fn_proxy, char *function_name, int function_name_len, zval \
**retval_ptr_ptr, int param_count, zval* arg1, zval* arg2, zval* arg3, zval* arg4, \
zval* arg5, zval* arg6, zval *arg7, zval *arg8, zval *arg9 TSRMLS_DC); +zval* \
mysqlnd_uh_call_method(zval **object_pp, zend_class_entry *obj_ce, zend_function \
**fn_proxy, char *function_name, int function_name_len, zval **retval_ptr_ptr, int \
param_count, zval* arg1, zval* arg2, zval* arg3, zval* arg4, zval* arg5, zval* arg6, \
zval *arg7, zval *arg8, zval *arg9, zval *arg10 TSRMLS_DC);
#define mysqlnd_uh_call_method_with_0_params(obj, fn_proxy, function_name, retval) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 0, NULL, NULL, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_1_params(obj, fn_proxy, function_name, retval, \
arg1) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 1, arg1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 1, arg1, NULL, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_2_params(obj, fn_proxy, function_name, retval, \
arg1, arg2) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 2, arg1, arg2, NULL, NULL, NULL, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 2, arg1, arg2, NULL, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_3_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 3, arg1, arg2, arg3, NULL, NULL, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 3, arg1, arg2, arg3, NULL, NULL, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_4_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 4, arg1, arg2, arg3, arg4, NULL, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 4, arg1, arg2, arg3, arg4, NULL, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_5_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 5, arg1, arg2, arg3, arg4, arg5, NULL, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 5, arg1, arg2, arg3, arg4, arg5, \
NULL, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_6_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5, arg6) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 6, arg1, arg2, arg3, arg4, arg5, arg6, NULL, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 6, arg1, arg2, arg3, arg4, arg5, \
arg6, NULL, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_7_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 7, arg1, arg2, arg3, arg4, arg5, arg6, arg7, NULL, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 7, arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, NULL, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_8_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 8, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, \
NULL TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 8, arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, arg8, NULL, NULL TSRMLS_CC)
#define mysqlnd_uh_call_method_with_9_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) \
- mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 9, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, \
arg9 TSRMLS_CC) + mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, \
function_name, sizeof(function_name)-1, (retval), 9, arg1, arg2, arg3, arg4, arg5, \
arg6, arg7, arg8, arg9, NULL TSRMLS_CC)
+#define mysqlnd_uh_call_method_with_10_params(obj, fn_proxy, function_name, retval, \
arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) \ \
+ mysqlnd_uh_call_method(&(obj), Z_OBJCE_P(obj), fn_proxy, function_name, \
sizeof(function_name)-1, (retval), 10, arg1, arg2, arg3, arg4, arg5, arg6, arg7, \
arg8, arg9, arg10 TSRMLS_CC) +
#define CHECK_ENABLED() \
if (!MYSQLND_UH_G(enabled)) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, \
MYSLQND_UH_WARNING_CLASS_PLUGIN_DISABLED); \
Modified: pecl/mysqlnd_uh/trunk/mysqlnd_uh_hooks_conn_data.c
===================================================================
--- pecl/mysqlnd_uh/trunk/mysqlnd_uh_hooks_conn_data.c 2013-12-19 10:01:14 UTC (rev \
332470)
+++ pecl/mysqlnd_uh/trunk/mysqlnd_uh_hooks_conn_data.c 2013-12-19 10:29:46 UTC (rev \
332471) @@ -736,8 +736,8 @@
MYSQLND_CONN_DATA_METHOD_ONE_ARG_CONN_RET_UINT64(get_affected_rows, getaffectedrows, \
getAffectedRows, const MYSQLND_CONN_DATA * const conn) \
MYSQLND_CONN_DATA_METHOD_ONE_ARG_CONN_RET_UINT(get_warning_count, getwarningcount, \
getWarningCount, const MYSQLND_CONN_DATA * const conn) \
MYSQLND_CONN_DATA_METHOD_ONE_ARG_CONN_RET_UINT(get_field_count, getfieldcount, \
getFieldCount, const MYSQLND_CONN_DATA * const conn) \
+MYSQLND_CONN_DATA_METHOD_ONE_ARG_CONN_RET_UINT(get_server_status, getserverstatus, \
getServerStatus, const MYSQLND_CONN_DATA * const conn)
-
/* {{{ */
enum_func_status MYSQLND_METHOD(mysqlnd_uh_conn_data, \
set_server_option)(MYSQLND_CONN_DATA * const conn, enum_mysqlnd_server_option option \
TSRMLS_DC) { enum_func_status ret = FAIL;
@@ -1130,7 +1130,7 @@
/* Backup originial function pointers in org_mysqlnd_conn_data_methods */
memcpy(&org_mysqlnd_conn_data_methods, my_mysqlnd_conn_data_methods, sizeof(struct \
st_mysqlnd_conn_data_methods)); /*
- func_mysqlnd_conn_data__connect connect;
+
func_mysqlnd_conn_data__get_server_status get_server_status;
func_mysqlnd_conn_data__free_options free_options;
@@ -1199,6 +1199,7 @@
my_mysqlnd_conn_data_methods->get_affected_rows = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, get_affected_rows); \
my_mysqlnd_conn_data_methods->get_warning_count = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, get_warning_count); \
my_mysqlnd_conn_data_methods->get_field_count = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, get_field_count); \
+ my_mysqlnd_conn_data_methods->get_server_status = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, get_server_status); \
my_mysqlnd_conn_data_methods->set_server_option = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, set_server_option); \
my_mysqlnd_conn_data_methods->set_client_option = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, set_client_option); \
my_mysqlnd_conn_data_methods->query_read_result_set_header = \
MYSQLND_METHOD(mysqlnd_uh_conn_data, query_read_result_set_header);
Added: pecl/mysqlnd_uh/trunk/tests/mysqlnd_uh_class_conn_data_m_get_server_status.phpt
===================================================================
--- pecl/mysqlnd_uh/trunk/tests/mysqlnd_uh_class_conn_data_m_get_server_status.phpt \
(rev 0)
+++ pecl/mysqlnd_uh/trunk/tests/mysqlnd_uh_class_conn_data_m_get_server_status.phpt 2013-12-19 \
10:29:46 UTC (rev 332471) @@ -0,0 +1,66 @@
+--TEST--
+int MysqlndUhConnectionData::getServerStatus(resource $connection)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once("skipifconnectfailure.inc");
+?>
+--FILE--
+<?php
+ require_once('config.inc');
+
+ class proxy extends MysqlndUhConnectionData {
+ public function getServerStatus($res) {
+ printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
+ var_dump($ret = parent::getServerStatus($res));
+ return $ret;
+ }
+ }
+
+ class proxy2 extends MysqlndUhConnectionData {
+ public function getServerStatus($res) {
+ return PHP_INT_MAX;
+ }
+ }
+
+ class proxy3 extends MysqlndUhConnectionData {
+ public function getServerStatus($res) {
+ return -1;
+ }
+ }
+ class proxy4 extends MysqlndUhConnectionData {
+ public function getServerStatus($res) {}
+ }
+
+ class proxy5 extends MysqlndUhConnectionData {
+ public function getServerStatus($res) {
+ return $res;
+ }
+ }
+
+ $conn = mysqlnd_uh_test\connect::mysqli();
+ $mysqlnd = mysqlnd_uh_convert_to_mysqlnd($conn);
+
+ $p = new proxy();
+ $p->getServerStatus($mysqlnd);
+
+ $p = new proxy2();
+ $p->getServerStatus($mysqlnd);
+
+ $p = new proxy3();
+ $p->getServerStatus($mysqlnd);
+
+ $p = new proxy4();
+ $p->getServerStatus($mysqlnd);
+
+ $p = new proxy5();
+ $p->getServerStatus($mysqlnd);
+
+ print "done!";
+?>
+--EXPECTF--
+proxy::getServerStatus(array (
+ 0 => NULL,
+))
+int(2)
+done!
\ No newline at end of file
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic