@@ -2028,6 +2028,81 @@ PHP_METHOD(Memcached, quit)
20282028}
20292029/* }}} */
20302030
2031+ #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
2032+ /* {{{ Memcached::getLastErrorMessage()
2033+ Returns the last error message that occurred */
2034+ PHP_METHOD (Memcached , getLastErrorMessage )
2035+ {
2036+ MEMC_METHOD_INIT_VARS ;
2037+
2038+ if (zend_parse_parameters_none () == FAILURE ) {
2039+ return ;
2040+ }
2041+
2042+ MEMC_METHOD_FETCH_OBJECT ;
2043+
2044+ RETURN_STRING (memcached_last_error_message (m_obj -> memc ), 1 );
2045+ }
2046+ /* }}} */
2047+
2048+ /* {{{ Memcached::getLastErrorCode()
2049+ Returns the last error code that occurred */
2050+ PHP_METHOD (Memcached , getLastErrorCode )
2051+ {
2052+ MEMC_METHOD_INIT_VARS ;
2053+
2054+ if (zend_parse_parameters_none () == FAILURE ) {
2055+ return ;
2056+ }
2057+
2058+ MEMC_METHOD_FETCH_OBJECT ;
2059+
2060+ RETURN_LONG (memcached_last_error (m_obj -> memc ));
2061+ }
2062+ /* }}} */
2063+
2064+ /* {{{ Memcached::getLastErrorErrno()
2065+ Returns the last error errno that occurred */
2066+ PHP_METHOD (Memcached , getLastErrorErrno )
2067+ {
2068+ MEMC_METHOD_INIT_VARS ;
2069+
2070+ if (zend_parse_parameters_none () == FAILURE ) {
2071+ return ;
2072+ }
2073+
2074+ MEMC_METHOD_FETCH_OBJECT ;
2075+
2076+ RETURN_LONG (memcached_last_error_errno (m_obj -> memc ));
2077+ }
2078+ /* }}} */
2079+ #endif
2080+
2081+ /* {{{ Memcached::getLastDisconnectedServer()
2082+ Returns the last disconnected server
2083+ Was added in 0.34 according to libmemcached's Changelog */
2084+ PHP_METHOD (Memcached , getLastDisconnectedServer )
2085+ {
2086+ memcached_server_instance_st * server_instance ;
2087+ MEMC_METHOD_INIT_VARS ;
2088+
2089+ if (zend_parse_parameters_none () == FAILURE ) {
2090+ return ;
2091+ }
2092+
2093+ MEMC_METHOD_FETCH_OBJECT ;
2094+
2095+ server_instance = memcached_server_get_last_disconnect (m_obj -> memc );
2096+ if (server_instance == NULL ) {
2097+ RETURN_FALSE ;
2098+ }
2099+
2100+ array_init (return_value );
2101+ add_assoc_string (return_value , "host" , (char * ) memcached_server_name (server_instance ), 1 );
2102+ add_assoc_long (return_value , "port" , memcached_server_port (server_instance ));
2103+ }
2104+ /* }}} */
2105+
20312106/* {{{ Memcached::getStats()
20322107 Returns statistics for the memcache servers */
20332108PHP_METHOD (Memcached , getStats )
@@ -3486,6 +3561,18 @@ ZEND_BEGIN_ARG_INFO(arginfo_getServerByKey, 0)
34863561 ZEND_ARG_INFO (0 , server_key )
34873562ZEND_END_ARG_INFO ()
34883563
3564+ ZEND_BEGIN_ARG_INFO (arginfo_getLastErrorMessage , 0 )
3565+ ZEND_END_ARG_INFO ()
3566+
3567+ ZEND_BEGIN_ARG_INFO (arginfo_getLastErrorCode , 0 )
3568+ ZEND_END_ARG_INFO ()
3569+
3570+ ZEND_BEGIN_ARG_INFO (arginfo_getLastErrorErrno , 0 )
3571+ ZEND_END_ARG_INFO ()
3572+
3573+ ZEND_BEGIN_ARG_INFO (arginfo_getLastDisconnectedServer , 0 )
3574+ ZEND_END_ARG_INFO ()
3575+
34893576ZEND_BEGIN_ARG_INFO (arginfo_getOption , 0 )
34903577 ZEND_ARG_INFO (0 , option )
34913578ZEND_END_ARG_INFO ()
@@ -3573,6 +3660,13 @@ static zend_function_entry memcached_class_methods[] = {
35733660 MEMC_ME (resetServerList , arginfo_resetServerList )
35743661 MEMC_ME (quit , arginfo_quit )
35753662
3663+ #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
3664+ MEMC_ME (getLastErrorMessage , arginfo_getLastErrorMessage )
3665+ MEMC_ME (getLastErrorCode , arginfo_getLastErrorCode )
3666+ MEMC_ME (getLastErrorErrno , arginfo_getLastErrorErrno )
3667+ #endif
3668+ MEMC_ME (getLastDisconnectedServer , arginfo_getLastDisconnectedServer )
3669+
35763670 MEMC_ME (getStats , arginfo_getStats )
35773671 MEMC_ME (getVersion , arginfo_getVersion )
35783672 MEMC_ME (getAllKeys , arginfo_getAllKeys )
0 commit comments