Documentation Home
MySQL 5.7 C API Developer Guide
Download this Manual
PDF (US Ltr) - 1.1Mb
PDF (A4) - 1.1Mb


6.4.18 mysql_stmt_num_rows()

my_ulonglongmysql_stmt_num_rows(MYSQL_STMT *stmt)

Description

Returns the number of rows in the result set.

The use ofmysql_stmt_num_rows() depends on whether you usedmysql_stmt_store_result() to buffer the entire result set in the statement handler. If you usemysql_stmt_store_result(),mysql_stmt_num_rows() may be called immediately. Otherwise, the row count is unavailable unless you count the rows as you fetch them.

mysql_stmt_num_rows() is intended for use with statements that return a result set, such asSELECT. For statements such asINSERT,UPDATE, orDELETE, the number of affected rows can be obtained withmysql_stmt_affected_rows().

Return Values

The number of rows in the result set.

Errors

None.