Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.
返回结果集中的行数。
sqlany_num_rows ( $stmt )
$stmt 由 sqlany_execute 或 sqlany_execute_direct 执行的语句对象。
返回标量值,即结果集中的行数。如果行数是估计值,则返回负数,且估计值为所返回整数的绝对值。如果行数为准确值,则返回值为正。
缺省情况下,此函数仅返回一个估计值。要返回准确计数,请在连接中设置 ROW_COUNTS 选项。有关详细信息,请参见row_counts 选项。
只能针对返回多个结果集的语句中的第一个结果集返回结果集中的行数计数。如果使用 sqlany_get_next_result 移动到下一个结果集,sqlany_num_rows 将仍返回第一个结果集中的行数。
stmt = api.sqlany_execute_direct( conn, "SELECT * FROM Employees" ) # Get number of rows in result set num_rows = api.sqlany_num_rows( stmt )