]> granicus.if.org Git - php/commitdiff
added new function mysqli_stmt_num_rows
authorGeorg Richter <georg@php.net>
Sun, 22 Jun 2003 08:46:39 +0000 (08:46 +0000)
committerGeorg Richter <georg@php.net>
Sun, 22 Jun 2003 08:46:39 +0000 (08:46 +0000)
ext/mysqli/mysqli_api.c
ext/mysqli/mysqli_fe.c
ext/mysqli/php_mysqli.h

index 2b4f52ad8508376cadd0b86af10ca1ba896fa505..3f85c08355e5c65ccad4f53f16db3c9121f57347 100644 (file)
@@ -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) 
index fd45d77c2030c64c6f83c288dd6cb04f76f217cd..47eb2cbd36f5afebd99dd031f9917d36caf13c13 100644 (file)
@@ -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
index b43d2d3a0aa27d524930173351720b4f4bb59b98..42a1336fd0c6753d6e4f31eb726cc2e5dbad41da 100644 (file)
@@ -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