MySQL :: MySQL 8.0 C API Developer Guide :: 6.4.18 mysql_stmt_num_rows() (original) (raw)

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 use mysql_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 as SELECT. For statements such as INSERT,UPDATE, orDELETE, the number of affected rows can be obtained withmysql_stmt_affected_rows().

Return Values

The number of rows in the result set.