The Typo3 DB LIB has a method called exec_SELECTcountRows. The implementation looks like this:
/**
* Counts the number of rows in a table.
*
* @param string $field: Name of the field to use in the
COUNT() expression (e.g. '*')
* @param string $table: Name of the table to count rows for
* @param string $where: (optional) WHERE statement of the query
* @return mixed Number of rows counter (integer) or
false if something went wrong (boolean)
*/
public function exec_SELECTcountRows($field, $table, $where = '') {
$count = FALSE;
$resultSet = $this->exec_SELECTquery('COUNT(' . $field . ')', $table, $where);
if ($resultSet !== FALSE) {
list($count) = $this->sql_fetch_row($resultSet);
$this->sql_free_result($resultSet);
}
return $count;
}
Question:
Is the return type of exec_SELECTcountRows truly an integer or rather a string containing one?
Actually you’re right. The PHPdoc differs from the behavior (as mysql functions return the value as string).
I filed a bug report, as I think this should be changed to return a true integer.