summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-04-24 14:04:58 +0000
committerAndrey Hristov <andrey@php.net>2008-04-24 14:04:58 +0000
commit5da78b297bde9402b4e92bd8d5ac7608da46a91d (patch)
tree5617e8974c9c7b08a09125df953d9095966915cc /ext/mysqli/mysqli_api.c
parentdedb146a691249b72cd583cc3c3f4cb56c4eabd3 (diff)
downloadphp-git-5da78b297bde9402b4e92bd8d5ac7608da46a91d.tar.gz
Update ext/mysql's and ext/mysqli's tests
Add mysqli_stmt_more_result()/mysqli_stmt_next_result(), but only in mysqlnd builds as libmysql doesn't support this feature.
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 51381e1bb1..8c8c3c32b5 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1529,6 +1529,48 @@ PHP_FUNCTION(mysqli_next_result) {
}
/* }}} */
+
+#ifdef MYSQLI_USE_MYSQLND
+/* {{{ proto bool mysqli_stmt_next_result(object link)
+ check if there any more query results from a multi query */
+PHP_FUNCTION(mysqli_stmt_more_results)
+{
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+ return;
+ }
+ MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
+
+ RETURN_BOOL(mysqlnd_stmt_more_results(stmt->stmt));
+}
+/* }}} */
+
+
+/* {{{ proto bool mysqli_stmt_next_result(object link)
+ read next result from multi_query */
+PHP_FUNCTION(mysqli_stmt_next_result) {
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
+ return;
+ }
+ MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
+
+ if (!mysqlnd_stmt_more_results(stmt->stmt)) {
+ php_error_docref(NULL TSRMLS_CC, E_STRICT, "There is no next result set. "
+ "Please, call mysqli_stmt_more_results()/mysqli_stmt::more_results() to check "
+ "whether to call this function/method");
+ }
+
+ RETURN_BOOL(!mysqlnd_stmt_next_result(stmt->stmt));
+}
+/* }}} */
+#endif
+
+
/* {{{ proto int mysqli_num_fields(object result) U
Get number of fields in result */
PHP_FUNCTION(mysqli_num_fields)