summaryrefslogtreecommitdiff
path: root/ext/mysql/php_mysql.c
diff options
context:
space:
mode:
authorJan Lehnardt <jan@php.net>2002-03-29 12:47:02 +0000
committerJan Lehnardt <jan@php.net>2002-03-29 12:47:02 +0000
commitbc19dd69005e805096078d0d20e96b7a7bde87e5 (patch)
tree41b154a44a5993dbca28a04b6848ec176630c405 /ext/mysql/php_mysql.c
parent17116438da18a5e7fdb3f56248a244c242a58956 (diff)
downloadphp-git-bc19dd69005e805096078d0d20e96b7a7bde87e5.tar.gz
- add mysql_info function
Diffstat (limited to 'ext/mysql/php_mysql.c')
-rw-r--r--ext/mysql/php_mysql.c30
1 files changed, 30 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)