From d1403fd7268ccf96ab6e7d04506ea1b1802c7eb2 Mon Sep 17 00:00:00 2001 From: alecpl Date: Fri, 2 May 2008 07:35:00 +0000 Subject: - fixed #1485032 and updated MDB2 package+drivers --- program/lib/MDB2/Driver/Manager/sqlite.php | 37 +++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) (limited to 'program/lib/MDB2/Driver/Manager/sqlite.php') 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 | // +----------------------------------------------------------------------+ // -// $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'; @@ -403,6 +403,37 @@ class MDB2_Driver_Manager_sqlite extends MDB2_Driver_Manager_Common return $db->exec("DROP TABLE $name"); } + // }}} + // {{{ 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; } -- cgit v1.2.3