summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
authorAndrey Hristov <andrey@php.net>2008-04-24 14:22:19 +0000
committerAndrey Hristov <andrey@php.net>2008-04-24 14:22:19 +0000
commitf4e659d2af2ba68eb6d9092560eb0247a33fb827 (patch)
tree0dd088ae74cb248da04cb842b65f00a356f50dbf /ext/mysqli/mysqli_api.c
parent2667f76d7b7f3fce7bc5a8374632dce5e34cb0b6 (diff)
downloadphp-git-f4e659d2af2ba68eb6d9092560eb0247a33fb827.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 6e1ff659a5..a8c376cf46 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1471,6 +1471,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)
Get number of fields in result */
PHP_FUNCTION(mysqli_num_fields)