summaryrefslogtreecommitdiffstats
path: root/class/CommonTable.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-11-01 18:40:08 +0100
committerRemi Collet <fedora@famillecollet.com>2010-11-01 18:40:08 +0100
commitdb257c7de11da2771a9f61733f21a42c98cf2a97 (patch)
tree3a93d847a2917e27f9a4f8402735176244f6a101 /class/CommonTable.php
parent8b50ace3024268b3067c0bf43bbd68f824b90d81 (diff)
add CommonTable->optimize() method and call it during refresh
Diffstat (limited to 'class/CommonTable.php')
-rw-r--r--class/CommonTable.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/class/CommonTable.php b/class/CommonTable.php
index b7cc93e..365ef19 100644
--- a/class/CommonTable.php
+++ b/class/CommonTable.php
@@ -84,7 +84,9 @@ abstract class CommonTable
$res = $this->db->exec($sql);
if ($res===false) {
$err = $this->db->errorInfo();
- throw new Exception("\nSQL: $sql\nERROR: ".$err[2]."\nCODE:");
+ throw new Exception(
+ "\nSQL: $sql\nERROR: " . $err[2] . "\nCODE:" . $err[0]
+ );
}
return $res;
}
@@ -316,6 +318,19 @@ abstract class CommonTable
}
/**
+ * Optimize the table
+ */
+ public function optimize()
+ {
+ $res = array();
+ foreach ($this->request('OPTIMIZE TABLE `'.$this->table.'`') as $row) {
+ $res[] = $row;
+ }
+ return $res;
+ }
+
+
+ /**
* Get the number of rows in the table
*/
public function getCount()