cvs: pear /MDB2/MDB2/Driver/Manager Common.php mysql.php mysqli.php

From: Date: Fri, 17 Mar 2006 08:21:53 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Manager Common.php mysql.php mysqli.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39140@lists.php.net to get a copy of this message
lsmith Fri Mar 17 08:21:53 2006 UTC Modified files: /pear/MDB2/MDB2/Driver/Manager Common.php mysql.php mysqli.php Log: - added optional database parameter to listTables() and listSequences() http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/Common.php?r1=1.45&r2=1.46&diff_format=u Index: pear/MDB2/MDB2/Driver/Manager/Common.php diff -u pear/MDB2/MDB2/Driver/Manager/Common.php:1.45 pear/MDB2/MDB2/Driver/Manager/Common.php:1.46 --- pear/MDB2/MDB2/Driver/Manager/Common.php:1.45 Mon Mar 13 15:11:22 2006 +++ pear/MDB2/MDB2/Driver/Manager/Common.php Fri Mar 17 08:21:53 2006 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.45 2006/03/13 15:11:22 lsmith Exp $ +// $Id: Common.php,v 1.46 2006/03/17 08:21:53 lsmith Exp $ // /** @@ -488,10 +488,11 @@ /** * list all tables in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listTables() + function listTables($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { @@ -759,10 +760,11 @@ /** * list all sequences in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listSequences() + function listSequences($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/mysql.php?r1=1.64&r2=1.65&diff_format=u Index: pear/MDB2/MDB2/Driver/Manager/mysql.php diff -u pear/MDB2/MDB2/Driver/Manager/mysql.php:1.64 pear/MDB2/MDB2/Driver/Manager/mysql.php:1.65 --- pear/MDB2/MDB2/Driver/Manager/mysql.php:1.64 Mon Mar 13 15:11:22 2006 +++ pear/MDB2/MDB2/Driver/Manager/mysql.php Fri Mar 17 08:21:53 2006 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.64 2006/03/13 15:11:22 lsmith Exp $ +// $Id: mysql.php,v 1.65 2006/03/17 08:21:53 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -510,17 +510,23 @@ /** * list all tables in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listTables() + function listTables($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } - $table_names = $db->queryCol('SHOW TABLES'); + $query = "SHOW TABLES"; + if(!is_null($database)) { + $query .= " FROM $database"; + } + + $table_names = $db->queryCol($query); if (PEAR::isError($table_names)) { return $table_names; } @@ -918,17 +924,22 @@ /** * list all sequences in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listSequences() + function listSequences($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } - $table_names = $db->queryCol('SHOW TABLES'); + $query = "SHOW TABLES"; + if(!is_null($database)) { + $query .= " FROM $database"; + } + $table_names = $db->queryCol($query); if (PEAR::isError($table_names)) { return $table_names; } http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/mysqli.php?r1=1.50&r2=1.51&diff_format=u Index: pear/MDB2/MDB2/Driver/Manager/mysqli.php diff -u pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.50 pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.51 --- pear/MDB2/MDB2/Driver/Manager/mysqli.php:1.50 Mon Mar 13 15:11:22 2006 +++ pear/MDB2/MDB2/Driver/Manager/mysqli.php Fri Mar 17 08:21:53 2006 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@pooteeweet.org> | // +----------------------------------------------------------------------+ // -// $Id: mysqli.php,v 1.50 2006/03/13 15:11:22 lsmith Exp $ +// $Id: mysqli.php,v 1.51 2006/03/17 08:21:53 lsmith Exp $ // require_once 'MDB2/Driver/Manager/Common.php'; @@ -510,17 +510,23 @@ /** * list all tables in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listTables() + function listTables($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } - $table_names = $db->queryCol('SHOW TABLES'); + $query = "SHOW TABLES"; + if(!is_null($database)) { + $query .= " FROM $database"; + } + + $table_names = $db->queryCol($query); if (PEAR::isError($table_names)) { return $table_names; } @@ -537,6 +543,7 @@ return $result; } + // }}} // {{{ listTableFields() @@ -918,17 +925,22 @@ /** * list all sequences in the current database * + * @param string database, the current is default * @return mixed data array on success, a MDB2 error on failure * @access public */ - function listSequences() + function listSequences($database = null) { $db =& $this->getDBInstance(); if (PEAR::isError($db)) { return $db; } - $table_names = $db->queryCol('SHOW TABLES'); + $query = "SHOW TABLES"; + if(!is_null($database)) { + $query .= " FROM $database"; + } + $table_names = $db->queryCol($query); if (PEAR::isError($table_names)) { return $table_names; }

« previous php.pear.cvs (#39140) next »