We currently use rowCount() on SELECT queries to count the number of items in a table, which is an incorrect usage of this method:
http://php.net/manual/en/pdostatement.rowcount.php
Instead we should use a method similar to the Aggregator module:
function _aggregator_has_categories() {
return user_access('access news feeds') && (bool) db_query_range('SELECT 1 FROM {aggregator_category}', 0, 1)->fetchField();
}
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1377754-3.remove_rowCount.patch | 4.99 KB | rszrama |
| #1 | 1377754.remove_rowCount.patch | 4.97 KB | rszrama |
Comments
Comment #1
rszrama commentedAlas, if only 'twere as simple as boolean queries. Instead for ours the count mattered because we used it in
format_plural()messages to indicate how many of each item remained. It wasn't too difficult to overcome, but it involved a variety of new EntityFieldQueries and use of the countQuery() method on the db_select object to make do.Let's let the testbot have a crack at it.
Comment #3
rszrama commentedFix attached. Bad copy / paste.
Comment #4
rszrama commentedAnd committed.