| | |
| | | // +----------------------------------------------------------------------+
|
| | | // | 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. |
|
| | | // +----------------------------------------------------------------------+
|
| | |
| | | // | 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>
|
| | | */
|
| | |
|
| | | /**
|
| | |
| | | * @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)) {
|
| | |
| | | }
|
| | |
|
| | | // }}}
|
| | | // {{{ 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()
|
| | |
|
| | | /**
|