countRecords property
Returns the count of records from results with the field count_records.
This method is specifically designed to work with COUNT queries where
the result includes a field named 'count_records'. It extracts and
converts this value to an integer.
Returns 0 if the field doesn't exist, can't be parsed, or if there
are no results.
Example:
// Query: SELECT COUNT(*) as count_records FROM users
var result = await table.select(conn, countQuery);
int totalUsers = result.countRecords;
print('Total users: $totalUsers');
Implementation
@override
int get countRecords {
return int.tryParse((assocFirst?[SqlDatabaseResult.countRecordsField] ?? 0)
.toString()) ??
0;
}