db2_num_rows

(PECL ibm_db2 >= 1.0.0)

db2_num_rows Returns the number of rows affected by an SQL statement

说明

db2_num_rows ( resource $stmt ) : int

Returns the number of rows deleted, inserted, or updated by an SQL statement.

To determine the number of rows that will be returned by a SELECT statement, issue SELECT COUNT(*) with the same predicates as your intended SELECT statement and retrieve the value.

If your application logic checks the number of rows returned by a SELECT statement and branches if the number of rows is 0, consider modifying your application to attempt to return the first row with one of db2_fetch_assoc(), db2_fetch_both(), db2_fetch_array(), or db2_fetch_row(), and branch if the fetch function returns FALSE.

Note:

If you issue a SELECT statement using a scrollable cursor, db2_num_rows() returns the number of rows returned by the SELECT statement. However, the overhead associated with scrollable cursors significantly degrades the performance of your application, so if this is the only reason you are considering using scrollable cursors, you should use a forward-only cursor and either call SELECT COUNT(*) or rely on the boolean return value of the fetch functions to achieve the equivalent functionality with much better performance.

参数

stmt

A valid stmt resource containing a result set.

返回值

Returns the number of rows affected by the last SQL statement issued by the specified statement handle.

相关文章
php cubrid mysql 兼容性函数 return the number of rows affected by the last sql statementphp ibm db2 函数 binds a php variable to an sql statement parameterphp ibm db2 函数 returns the cursor type used by a statement resourcephp ibm db2 函数 executes an sql statement directlyphp ibm db2 函数 executes a prepared sql statementphp ibm db2 函数 returns the maximum number of bytes required to display a columnphp ibm db2 函数 retrieves an option value for a statement resource or a connection resourcephp ibm db2 函数 returns the number of fields contained in a result setphp ibm db2 函数 returns the number of rows affected by an sql statementphp ibm db2 函数 prepares an sql statement to be executedphp ibm db2 函数 returns a result set listing the unique row identifier columns for a tablephp ibm db2 函数 returns a string containing the sqlstate returned by an sql statementphp ibm db2 函数 returns a string containing the last sql statement error messagephp frontbase 函数 get the number of rows affected by the last statementphp maxdb 函数 gets the number of affected rows in a previous maxdb operationphp maxdb 函数 returns the total number of rows changed deleted or inserted by the last executed statementphp msql 函数 returns number of affected rowsphp sqlite 函数 returns the number of rows that were changed by the most recent sql statementphp sqlsrv 函数 returns the number of rows modified by the last insert update or delete query executedphp sqlite3 returns the number of database rows that were changed or inserted or deleted by the most recent sql statement
关注编程学问公众号