Skip to content

Commit 46b311e

Browse files
author
Andrei Zmievski
committed
Add getResultMessage() method.
1 parent da40d57 commit 46b311e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

php_memcached.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,6 +1841,31 @@ static PHP_METHOD(Memcached, getResultCode)
18411841
}
18421842
/* }}} */
18431843

1844+
/* {{{ Memcached::getResultMessage()
1845+
Returns the result message from the last operation */
1846+
static PHP_METHOD(Memcached, getResultMessage)
1847+
{
1848+
MEMC_METHOD_INIT_VARS;
1849+
1850+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") == FAILURE) {
1851+
return;
1852+
}
1853+
1854+
MEMC_METHOD_FETCH_OBJECT;
1855+
1856+
switch (MEMC_G(rescode)) {
1857+
case MEMC_RES_PAYLOAD_FAILURE:
1858+
RETURN_STRING("PAYLOAD FAILURE", 1);
1859+
break;
1860+
1861+
default:
1862+
RETURN_STRING(memcached_strerror(i_obj->memc, MEMC_G(rescode)), 1);
1863+
break;
1864+
}
1865+
1866+
}
1867+
/* }}} */
1868+
18441869

18451870
/****************************************
18461871
Internal support code
@@ -2499,6 +2524,9 @@ ZEND_END_ARG_INFO()
24992524
ZEND_BEGIN_ARG_INFO(arginfo_getResultCode, 0)
25002525
ZEND_END_ARG_INFO()
25012526

2527+
ZEND_BEGIN_ARG_INFO(arginfo_getResultMessage, 0)
2528+
ZEND_END_ARG_INFO()
2529+
25022530
ZEND_BEGIN_ARG_INFO_EX(arginfo_get, 0, 0, 1)
25032531
ZEND_ARG_INFO(0, key)
25042532
ZEND_ARG_INFO(0, cache_cb)
@@ -2699,6 +2727,7 @@ static zend_function_entry memcached_class_methods[] = {
26992727
MEMC_ME(__construct, arginfo___construct)
27002728

27012729
MEMC_ME(getResultCode, arginfo_getResultCode)
2730+
MEMC_ME(getResultMessage, arginfo_getResultMessage)
27022731

27032732
MEMC_ME(get, arginfo_get)
27042733
MEMC_ME(getByKey, arginfo_getByKey)

0 commit comments

Comments
 (0)