summaryrefslogtreecommitdiff
path: root/program/lib/MDB2/Driver/Manager/sqlite.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib/MDB2/Driver/Manager/sqlite.php')
-rw-r--r--program/lib/MDB2/Driver/Manager/sqlite.php37
1 files changed, 34 insertions, 3 deletions
diff --git a/program/lib/MDB2/Driver/Manager/sqlite.php b/program/lib/MDB2/Driver/Manager/sqlite.php
index f126ff146..676127c94 100644
--- a/program/lib/MDB2/Driver/Manager/sqlite.php
+++ b/program/lib/MDB2/Driver/Manager/sqlite.php
@@ -2,7 +2,7 @@
// +----------------------------------------------------------------------+
// | PHP versions 4 and 5 |
// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2007 Manuel Lemos, Tomas V.V.Cox, |
+// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
// | Stig. S. Bakken, Lukas Smith, Lorenzo Alberton |
// | All rights reserved. |
// +----------------------------------------------------------------------+
@@ -43,7 +43,7 @@
// | Lorenzo Alberton <l.alberton@quipo.it> |
// +----------------------------------------------------------------------+
//
-// $Id: sqlite.php,v 1.72 2007/12/03 20:59:15 quipo Exp $
+// $Id: sqlite.php,v 1.74 2008/03/05 11:08:53 quipo Exp $
//
require_once 'MDB2/Driver/Manager/Common.php';
@@ -404,6 +404,37 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
}
// }}}
+ // {{{ vacuum()
+
+ /**
+ * Optimize (vacuum) all the tables in the db (or only the specified table)
+ * and optionally run ANALYZE.
+ *
+ * @param string $table table name (all the tables if empty)
+ * @param array $options an array with driver-specific options:
+ * - timeout [int] (in seconds) [mssql-only]
+ * - analyze [boolean] [pgsql and mysql]
+ * - full [boolean] [pgsql-only]
+ * - freeze [boolean] [pgsql-only]
+ *
+ * @return mixed MDB2_OK success, a MDB2 error on failure
+ * @access public
+ */
+ function vacuum($table = null, $options = array())
+ {
+ $db =& $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+
+ $query = 'VACUUM';
+ if (!empty($table)) {
+ $query .= ' '.$db->quoteIdentifier($table, true);
+ }
+ return $db->exec($query);
+ }
+
+ // }}}
// {{{ alterTable()
/**
@@ -1207,7 +1238,7 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common
if (PEAR::isError($table_def)) {
return $table_def;
}
- if (preg_match("/\bPRIMARY\s+KEY\b\s*\(([^)]+)/i", $table_def, $tmp)) {
+ if (preg_match("/\bPRIMARY\s+KEY\b/i", $table_def, $tmp)) {
$result['primary'] = true;
}