]> granicus.if.org Git - php/commitdiff
- add mysql_info function
authorJan Lehnardt <jan@php.net>
Fri, 29 Mar 2002 12:47:02 +0000 (12:47 +0000)
committerJan Lehnardt <jan@php.net>
Fri, 29 Mar 2002 12:47:02 +0000 (12:47 +0000)
ext/mysql/php_mysql.c
ext/mysql/php_mysql.h

index 2f45ed70a28d3634a29012946a0b9cda128b72d0..95e227f72d63d158519d43193efb0f68d0ecf0ba 100644 (file)
@@ -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)
index 87399222d9347adbe070ddeaf6526b61d2f29c89..d62b277bed0b77fca120767674a24cce9348942b 100644 (file)
@@ -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);