summaryrefslogtreecommitdiff
path: root/program/lib/MDB2/Driver/Manager/Common.php
diff options
context:
space:
mode:
Diffstat (limited to 'program/lib/MDB2/Driver/Manager/Common.php')
-rw-r--r--program/lib/MDB2/Driver/Manager/Common.php81
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 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 <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>
*/
/**
@@ -199,6 +201,29 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
}
// }}}
+ // {{{ 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()
/**
@@ -360,6 +385,56 @@ class MDB2_Driver_Manager_Common extends MDB2_Module_Common
}
// }}}
+ // {{{ 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()
/**