summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Richter <georg@php.net>2003-06-22 08:46:39 +0000
committerGeorg Richter <georg@php.net>2003-06-22 08:46:39 +0000
commit5655ebe6f26301f0f087623f8e8508be73b3cbcc (patch)
tree6f7f2a8db6e9dadb6ab455fc9a4b7005baa0f901
parentbb37c9c335128f9095c4173d5f0fe22efc80ce5c (diff)
downloadphp-git-5655ebe6f26301f0f087623f8e8508be73b3cbcc.tar.gz
added new function mysqli_stmt_num_rows
-rw-r--r--ext/mysqli/mysqli_api.c19
-rw-r--r--ext/mysqli/mysqli_fe.c2
-rw-r--r--ext/mysqli/php_mysqli.h1
3 files changed, 22 insertions, 0 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 2b4f52ad85..3f85c08355 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -1700,6 +1700,25 @@ PHP_FUNCTION(mysqli_stmt_close)
}
/* }}} */
+/* {{{ proto mixed mysqli_stmt_num_rows(object stmt)
+ Return the number of rows in statements result set */
+PHP_FUNCTION(mysqli_stmt_num_rows)
+{
+ STMT *stmt;
+ zval *mysql_stmt;
+ my_ulonglong rc;
+ PR_STMT *prstmt;
+
+ 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 *, prstmt, PR_STMT *, &mysql_stmt, "mysqli_stmt");
+
+ rc = mysql_stmt_num_rows(stmt->stmt);
+ MYSQLI_RETURN_LONG_LONG(rc)
+}
+/* }}} */
+
/* {{{ proto string mysqli_select_db(object link, string dbname)
Select a MySQL database */
PHP_FUNCTION(mysqli_select_db)
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index fd45d77c20..47eb2cbd36 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.c
@@ -114,6 +114,7 @@ function_entry mysqli_functions[] = {
PHP_FE(mysqli_stmt_close, NULL)
PHP_FE(mysqli_stmt_errno, NULL)
PHP_FE(mysqli_stmt_error, NULL)
+ PHP_FE(mysqli_stmt_num_rows, NULL)
#if MYSQL_VERSION_ID >= 40101
PHP_FE(mysqli_stmt_sqlstate, NULL)
#endif
@@ -231,6 +232,7 @@ function_entry mysqli_stmt_methods[] = {
PHP_FALIAS(close,mysqli_stmt_close,NULL)
PHP_FALIAS(errno,mysqli_stmt_errno,NULL)
PHP_FALIAS(error,mysqli_stmt_error,NULL)
+ PHP_FALIAS(num_rows, mysqli_stmt_num_rows,NULL)
#if MYSQL_VERSION_ID >= 40101
PHP_FALIAS(sqlstate, mysqli_stmt_sqlstate,NULL)
#endif
diff --git a/ext/mysqli/php_mysqli.h b/ext/mysqli/php_mysqli.h
index b43d2d3a0a..42a1336fd0 100644
--- a/ext/mysqli/php_mysqli.h
+++ b/ext/mysqli/php_mysqli.h
@@ -263,6 +263,7 @@ PHP_FUNCTION(mysqli_stmt_affected_rows);
PHP_FUNCTION(mysqli_stmt_close);
PHP_FUNCTION(mysqli_stmt_errno);
PHP_FUNCTION(mysqli_stmt_error);
+PHP_FUNCTION(mysqli_stmt_num_rows);
#if MYSQL_VERSION_ID >= 40101
PHP_FUNCTION(mysqli_stmt_sqlstate);
#endif