From a3bd712b7805e19446ced7c951959ee0c08c259f Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Wed, 10 Mar 2004 09:50:05 +0000 Subject: [PATCH] added new function mysql_stmt_free_result --- ext/mysqli/mysqli_api.c | 21 +++++++++++++++++++++ ext/mysqli/mysqli_fe.c | 4 ++++ ext/mysqli/php_mysqli.h | 3 +++ 3 files changed, 28 insertions(+) diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 876b39afc9..6a25920f93 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -1483,6 +1483,27 @@ PHP_FUNCTION(mysqli_stmt_data_seek) } /* }}} */ +#ifndef HAVE_MYSQLI_OLDAPI +/* {{{ proto void mysqli_stmt_free_result(object stmt) + Free stored result memory for the given statement handle */ +PHP_FUNCTION(mysqli_stmt_free_result) +{ + 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, STMT *, &mysql_stmt, "mysqli_stmt"); + + mysql_stmt_free_result(stmt->stmt); + + return; +} +/* }}} */ +#endif + /* {{{ proto mixed mysqli_stmt_num_rows(object stmt) Return the number of rows in statements result set */ PHP_FUNCTION(mysqli_stmt_num_rows) diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c index 6c83c1df71..dbbbbb301d 100644 --- a/ext/mysqli/mysqli_fe.c +++ b/ext/mysqli/mysqli_fe.c @@ -124,6 +124,9 @@ function_entry mysqli_functions[] = { PHP_FE(mysqli_stmt_bind_param, third_arg_force_by_ref_rest) PHP_FE(mysqli_stmt_bind_result, second_arg_force_by_ref_rest) PHP_FE(mysqli_stmt_fetch, NULL) +#ifndef HAVE_MYSQLI_OLDAPI + PHP_FE(mysqli_stmt_free_result, NULL) +#endif PHP_FE(mysqli_stmt_param_count, NULL) PHP_FE(mysqli_send_query, NULL) #ifdef HAVE_EMBEDDED_MYSQLI @@ -267,6 +270,7 @@ function_entry mysqli_stmt_methods[] = { PHP_FALIAS(send_long_data,mysqli_stmt_send_long_data,NULL) PHP_FALIAS(stmt,mysqli_prepare,NULL) #ifndef HAVE_MYSQLI_OLDAPI + PHP_FALIAS(free_result,mysqli_stmt_free_result,NULL) PHP_FALIAS(prepare,mysqli_stmt_prepare, NULL) #endif PHP_FALIAS(store_result,mysqli_stmt_store_result,NULL) diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h index 7d1032ec51..a19c51eaa1 100644 --- a/ext/mysqli/php_mysqli.h +++ b/ext/mysqli/php_mysqli.h @@ -347,6 +347,9 @@ PHP_FUNCTION(mysqli_stmt_close); PHP_FUNCTION(mysqli_stmt_data_seek); PHP_FUNCTION(mysqli_stmt_errno); PHP_FUNCTION(mysqli_stmt_error); +#ifndef HAVE_MYSQLI_OLDAPI +PHP_FUNCTION(mysqli_stmt_free_result); +#endif PHP_FUNCTION(mysqli_stmt_num_rows); #if MYSQL_VERSION_ID >= 40101 PHP_FUNCTION(mysqli_stmt_sqlstate); -- 2.40.0