Feature #19786

Integrate TYPO3_DB->exec_SELECTcountRows()

Added by Oliver Hader almost 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2009-01-10
Due date:
% Done:

0%

PHP Version:
5.2
Tags:
Complexity:
Sprint Focus:

Description

In the TYPO Core counting rows is/was implemented as the following:
  • get result set for a "COUNT" query, fetch row, free result set (not in all cases)
  • get result set for a regular table SELECT, get sql_num_rows, free result set (not in all cases again)

To simplify this, it would be nice, to have an accordant method in the database API that takes care of counting rows.

There was a discussion in the dev-list some months ago and Masi had the idea to introduce such a function in TYPO3_DB, read the thread here:
http://support.typo3.org/general/dev/m/typo3-dev-tip-use-sql-function-count-354264/p/234/

(issue imported from #M10091)

00010091_v2.patch View (1 KB) Administrator Admin, 2009-01-10 16:11


Related issues

Related to TYPO3 Core - Feature #19793: Use TYPO3_DB->exec_SELECTcountRows() to determine the number of rows Closed 2009-01-11

History

#1 Updated by Oliver Hader almost 11 years ago

Attached is a patch that implements TYPO3_DB->exec_SELECTcountRows($table, $where = '').
It's not required to put it to DBAL since DBAL extends t3lib_DB and the new method introduced with this issue calls available methods that get overridden in DBAL.

#2 Updated by Oliver Hader almost 11 years ago

The attached new patch adds the possibility to define the field used in the COUNT expression.

#3 Updated by Oliver Hader almost 11 years ago

Committed to SVN Trunk (rev. 4690)

Also available in: Atom PDF