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/Common.php | 81 ++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 3 deletions(-) (limited to 'program/lib/MDB2/Driver/Manager/Common.php') diff --git a/program/lib/MDB2/Driver/Manager/Common.php b/program/lib/MDB2/Driver/Manager/Common.php index da2e329ef..672f577ee 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 | +// | Authors: Lukas Smith | +// | Lorenzo Alberton | // +----------------------------------------------------------------------+ // -// $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 + * @author Lorenzo Alberton */ /** @@ -198,6 +200,29 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common '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)) { + return $db; + } + + return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, + 'method not implemented', __FUNCTION__); + } + // }}} // {{{ dropDatabase() @@ -359,6 +384,56 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common return $db->exec("DROP TABLE $name"); } + // }}} + // {{{ 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() -- cgit v1.2.3