From d1403fd7268ccf96ab6e7d04506ea1b1802c7eb2 Mon Sep 17 00:00:00 2001 From: alecpl <alec@alec.pl> Date: Fri, 02 May 2008 03:35:00 -0400 Subject: [PATCH] - fixed #1485032 and updated MDB2 package+drivers --- program/lib/MDB2/Driver/Manager/Common.php | 81 +++++++++++++++++++++++++++++++++++++++- 1 files changed, 78 insertions(+), 3 deletions(-) diff --git a/program/lib/MDB2/Driver/Manager/Common.php b/program/lib/MDB2/Driver/Manager/Common.php index da2e329..672f577 100644 --- a/program/lib/MDB2/Driver/Manager/Common.php +++ b/program/lib/MDB2/Driver/Manager/Common.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 | // | All rights reserved. | // +----------------------------------------------------------------------+ @@ -39,16 +39,18 @@ // | WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | // | POSSIBILITY OF SUCH DAMAGE. | // +----------------------------------------------------------------------+ -// | Author: Lukas Smith <smith@pooteeweet.org> | +// | Authors: Lukas Smith <smith@pooteeweet.org> | +// | Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.68 2007/12/03 20:59:15 quipo Exp $ +// $Id: Common.php,v 1.71 2008/02/12 23:12:27 quipo Exp $ // /** * @package MDB2 * @category Database * @author Lukas Smith <smith@pooteeweet.org> + * @author Lorenzo Alberton <l.alberton@quipo.it> */ /** @@ -188,6 +190,29 @@ * @access public */ function createDatabase($database, $options = array()) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + + return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'method not implemented', __FUNCTION__); + } + + // }}} + // {{{ alterDatabase() + + /** + * alter an existing database + * + * @param string $name name of the database that should be created + * @param array $options array with charset, collation info + * + * @return mixed MDB2_OK on success, a MDB2 error on failure + * @access public + */ + function alterDatabase($database, $options = array()) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { @@ -360,6 +385,56 @@ } // }}} + // {{{ truncateTable() + + /** + * Truncate an existing table (if the TRUNCATE TABLE syntax is not supported, + * it falls back to a DELETE FROM TABLE query) + * + * @param string $name name of the table that should be truncated + * @return mixed MDB2_OK on success, a MDB2 error on failure + * @access public + */ + function truncateTable($name) + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + + $name = $db->quoteIdentifier($name, true); + return $db->exec("DELETE FROM $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; + } + + return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'method not implemented', __FUNCTION__); + } + + // }}} // {{{ alterTable() /** -- Gitblit v1.9.1