执行query.exec()返回true,说明执行成功,再调用int QSqlQuery::numRowsAffected ()获取sql语句执行影响的行数。
Returns the number of rows affected by the result's SQL statement, or -1 if it cannot be determined. Note that for SELECT statements, the value is undefined; use size() instead. If the query is not active, -1 is returned.