View Issue Details

IDProjectCategoryView StatusLast Update
149PHPOF2Defaultpublic16 Apr 2009 07:29
Reportermrosenquist Assigned Totimj  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Target Version0.11.1Fixed in Version0.11.1 
Summary149: Add DBTable::numRows() function
Descriptionadd hasRows() and/or countRows() to DBTable

hasRows() Returns boolean false if there are no values in the table
public function hasRows()
{
$sql = 'SELECT count(*) FROM ' . $this->db->quoteIdentifier($this->name) . ' LIMIT 1';
$count = $this->db->queryOne($sql);
return (int)$count == 1;
}

countRows()Returns int number of the rows for the table
public function hasRows()
{
$sql = 'SELECT count(*) FROM ' . $this->db->quoteIdentifier($this->name);
return (int)$this->db->queryOne($sql);
}
TagsNo tags attached.

Activities

timj

15 Apr 2009 18:32

manager   ~195

Fixed in SVN r1612

Issue History

Date Modified Username Field Change
21 Jan 2009 09:45 mrosenquist New Issue
15 Apr 2009 13:31 timj Target Version => 0.11.1
15 Apr 2009 18:32 timj Note Added: 195
15 Apr 2009 18:32 timj Assigned To => timj
15 Apr 2009 18:32 timj Status new => resolved
15 Apr 2009 18:32 timj Resolution open => fixed
15 Apr 2009 18:32 timj Fixed in Version => 0.11.1
15 Apr 2009 18:32 timj Summary add hasRows() and/or countRows() to DBTable => Add DBTable::numRows() function
16 Apr 2009 07:29 timj Status resolved => closed