| | |
| | | // +----------------------------------------------------------------------+
|
| | | // | 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. |
|
| | | // +----------------------------------------------------------------------+
|
| | |
| | | // | 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';
|
| | |
| | |
|
| | | $name = $db->quoteIdentifier($name, true);
|
| | | 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);
|
| | | }
|
| | |
|
| | | // }}}
|
| | |
| | | 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;
|
| | | }
|
| | |
|