com php-src: add mysql_warning_count(): ext/mysql/p hp_mysql.c ext/mysql/php_mysql_structs.h
| From: | Antony Dovgal | Date: | Thu, 12 Dec 2013 08:47:42 +0000 |
| Subject: | com php-src: add mysql_warning_count(): ext/mysql/p hp_mysql.c ext/mysql/php_mysql_structs.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-76640@lists.php.net to get a copy of this message | ||
Commit: 505483796d1fabbc0285f580221c84fb57d91874
Author: Antony Dovgal <tony2001@php.net> Mon, 5 Aug 2013 15:05:19 +0400
Parents: e01efb40e14c2a5e495582764b0c9d9bee98888e
Branches: badoo-5.5_mysqlnd
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=505483796d1fabbc0285f580221c84fb57d91874
Log:
add mysql_warning_count()
Changed paths:
M ext/mysql/php_mysql.c
M ext/mysql/php_mysql_structs.h
Diff:
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 344ad6a..aaf1344 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -293,6 +293,7 @@ static const zend_function_entry mysql_functions[] = {
#endif
PHP_FE(mysql_info, arginfo__optional_mysql_link)
+ PHP_FE(mysql_warning_count, NULL)
#ifdef MYSQL_HAS_SET_CHARSET
PHP_FE(mysql_set_charset, arginfo_mysql_set_charset)
#endif
@@ -1305,6 +1306,31 @@ PHP_FUNCTION(mysql_info)
}
/* }}} */
+/* {{{ proto int mysql_warning_count([int link_identifier])
+ Returns the number of errors, warnings, and notes generated during execution of the previous SQL
statement. */
+PHP_FUNCTION(mysql_warning_count)
+{
+ zval *mysql_link = NULL;
+ int id = -1;
+ unsigned int cnt;
+ 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);
+
+ cnt = mysql_warning_count(mysql->conn);
+ RETURN_LONG(cnt);
+}
+/* }}} */
+
/* {{{ 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_structs.h b/ext/mysql/php_mysql_structs.h
index d494e90..9eb3b00 100644
--- a/ext/mysql/php_mysql_structs.h
+++ b/ext/mysql/php_mysql_structs.h
@@ -102,6 +102,7 @@ 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_warning_count);
PHP_FUNCTION(mysql_stat);
PHP_FUNCTION(mysql_thread_id);
PHP_FUNCTION(mysql_client_encoding);