dbQueryGetNumRowsAffected#

Purpose#

Reports the number of rows affected by the result’s SQL statement.

Format#

num_rows = dbQueryGetNumRowsAffected(qid)#
Parameters:

qid (scalar) – query number.

Returns:

num_rows (scalar) – the number of rows affected by the result’s SQL statement, or a -1 if it cannot be determined or the query is not active.

Examples#

// Create and prepare query
qid = dbCreateQuery(db_id, "INSERT INTO
     PEOPLE (fname, lname) VALUES
     ('John', 'Doe');");

// Print report of number of rows affected
print dbQueryGetNumRowsAffected(qid) " row(s) were affected";
1 row(s) were affected

Remarks#

Note that for SELECT statements, the value is undefined; use dbQueryRows() instead.

See also

Functions dbQueryRows(), dbHasFeature()