📄 function.db2-num-rows.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Returns the number of rows affected by an SQL statement</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.db2-num-fields.html">db2_num_fields</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.db2-pconnect.html">db2_pconnect</a></div> <div class="up"><a href="ref.ibm-db2.html">IBM DB2 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.db2-num-rows" class="refentry"> <div class="refnamediv"> <h1 class="refname">db2_num_rows</h1> <p class="verinfo">(PECL ibm_db2:1.0-1.6.2)</p><p class="refpurpose"><span class="refname">db2_num_rows</span> — <span class="dc-title"> Returns the number of rows affected by an SQL statement </span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">int</span> <span class="methodname"><b><b>db2_num_rows</b></b></span> ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$stmt</tt></span> )</div> <p class="para rdfs-comment"> Returns the number of rows deleted, inserted, or updated by an SQL statement. </p> <p class="para"> 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. </p> <p class="para"> 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 <a href="function.db2-fetch-assoc.html" class="function">db2_fetch_assoc()</a>, <a href="function.db2-fetch-both.html" class="function">db2_fetch_both()</a>, <a href="function.db2-fetch-array.html" class="function">db2_fetch_array()</a>, or <a href="function.db2-fetch-row.html" class="function">db2_fetch_row()</a>, and branch if the fetch function returns <b><tt>FALSE</tt></b>. </p> <blockquote><p><b class="note">Note</b>: If you issue a SELECT statement using a scrollable cursor, <b>db2_num_rows()</b> 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 <a href="language.types.boolean.html" class="type boolean">boolean</a> return value of the fetch functions to achieve the equivalent functionality with much better performance. <br /> </p></blockquote> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">stmt</tt></i></span> <dd> <p class="para"> A valid <i>stmt</i> resource containing a result set. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns the number of rows affected by the last SQL statement issued by the specified statement handle. </p> </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.db2-num-fields.html">db2_num_fields</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.db2-pconnect.html">db2_pconnect</a></div> <div class="up"><a href="ref.ibm-db2.html">IBM DB2 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -