diff options
Diffstat (limited to 'ext/mysql')
| -rw-r--r-- | ext/mysql/php_mysql.c | 30 | ||||
| -rw-r--r-- | ext/mysql/php_mysql.h | 1 | 
2 files changed, 31 insertions, 0 deletions
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index 2f45ed70a2..95e227f72d 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -166,6 +166,8 @@ function_entry mysql_functions[] = {  	PHP_FE(mysql_get_proto_info,						NULL)  	PHP_FE(mysql_get_server_info,						NULL)  #endif + +    PHP_FE(mysql_info,		            				NULL)  	/* for downwards compatability */  	PHP_FALIAS(mysql,				mysql_db_query,		NULL) @@ -909,6 +911,34 @@ PHP_FUNCTION(mysql_get_server_info)  }  /* }}} */ +/* {{{ proto string mysql_info([int link_identifier]) +   Returns a string containing information about the most recent query */ +PHP_FUNCTION(mysql_info) +{ +	zval **mysql_link; +	int id; +    char *str; +	php_mysql_conn *mysql; + +	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link) == FAILURE) { +		return; +	} +	 +    if (ZEND_NUM_ARGS() == 0) { +		id = php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); +		CHECK_LINK(id); +	} + +	ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id, "MySQL-Link", le_link, le_plink); +     +	if (str = mysql_info(&mysql->conn)) { +		RETURN_STRING(str,1); +	} else { +		RETURN_FALSE; +	} +} +/* }}} */ +  /* {{{ proto int mysql_thread_id([int link_identifier])  	Returns the thread id of current connection */  PHP_FUNCTION(mysql_thread_id) diff --git a/ext/mysql/php_mysql.h b/ext/mysql/php_mysql.h index 87399222d9..d62b277bed 100644 --- a/ext/mysql/php_mysql.h +++ b/ext/mysql/php_mysql.h @@ -86,6 +86,7 @@ PHP_FUNCTION(mysql_get_client_info);  PHP_FUNCTION(mysql_get_host_info);  PHP_FUNCTION(mysql_get_proto_info);  PHP_FUNCTION(mysql_get_server_info); +PHP_FUNCTION(mysql_info);  PHP_FUNCTION(mysql_stat);  PHP_FUNCTION(mysql_thread_id);  PHP_FUNCTION(mysql_character_set_name);  | 
