diff options
Diffstat (limited to 'class/CommonTable.php')
-rw-r--r-- | class/CommonTable.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php index 0aeeb29..b7cc93e 100644 --- a/class/CommonTable.php +++ b/class/CommonTable.php @@ -306,6 +306,26 @@ abstract class CommonTable } return $tab; } + + /** + * Truncate the table + */ + public function truncate() + { + return $this->exec('TRUNCATE `'.$this->table.'`'); + } + + /** + * Get the number of rows in the table + */ + public function getCount() + { + $sql = 'SELECT COUNT(*) AS cpt FROM `'.$this->table.'`'; + foreach ($this->request($sql) as $row) { + return ($row['cpt']); + } + return 0; + } } ?>
\ No newline at end of file |