cvs: pear /MDB manager_mysql.php manager_pgsql.php metabase_wrapper.php mysql.php
| From: | Lukas Smith | Date: | Sun, 21 Jul 2002 00:13:47 +0000 |
| Subject: | cvs: pear /MDB manager_mysql.php manager_pgsql.php metabase_wrapper.php mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5228@lists.php.net to get a copy of this message | ||
lsmith Sat Jul 20 20:13:47 2002 EDT
Modified files:
/pear/MDB mysql.php metabase_wrapper.php manager_pgsql.php
manager_mysql.php
Log:
set fetchmode to DB_FETCHMODE_ORDERED in several places where the default mode would be
undesireable
Index: pear/MDB/mysql.php
diff -u pear/MDB/mysql.php:1.28 pear/MDB/mysql.php:1.29
--- pear/MDB/mysql.php:1.28 Sat Jul 20 19:40:16 2002
+++ pear/MDB/mysql.php Sat Jul 20 20:13:46 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: mysql.php,v 1.28 2002/07/20 23:40:16 lsmith Exp $
+// $Id: mysql.php,v 1.29 2002/07/21 00:13:46 lsmith Exp $
//
// MDB mysql driver.
//
@@ -428,7 +428,7 @@
if($this->supported["SubSelects"] == 1) {
return($query);
}
- $col = $this->queryCol($query);
+ $col = $this->queryCol($query, NULL, DB_FETCHMODE_ORDERED);
if (MDB::isError($col)) {
return $col;
}
Index: pear/MDB/metabase_wrapper.php
diff -u pear/MDB/metabase_wrapper.php:1.19 pear/MDB/metabase_wrapper.php:1.20
--- pear/MDB/metabase_wrapper.php:1.19 Sat Jul 20 19:40:45 2002
+++ pear/MDB/metabase_wrapper.php Sat Jul 20 20:13:46 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: metabase_wrapper.php,v 1.19 2002/07/20 23:40:45 lsmith Exp $
+// $Id: metabase_wrapper.php,v 1.20 2002/07/21 00:13:46 lsmith Exp $
//
// Metabase Wrapper for MDB.
//
@@ -152,7 +152,7 @@
function MetabaseQueryColumn($database, $query, &$column, $type = "text")
{
global $databases;
- $result = $databases[$database]->queryCol($query, $type);
+ $result = $databases[$database]->queryCol($query, $type, DB_FETCHMODE_ORDERED);
if (MDB::isError($result)) {
$databases[$database]->setError('', $result->getMessage());
return(0);
@@ -578,7 +578,7 @@
function MetabaseFetchResultColumn($database, $result, &$column)
{
global $databases;
- $result = $databases[$database]->fetchCol($result);
+ $result = $databases[$database]->fetchCol($result, DB_FETCHMODE_ORDERED);
if (MDB::isError($result)) {
$databases[$database]->setError('', $result->getMessage());
return(0);
Index: pear/MDB/manager_pgsql.php
diff -u pear/MDB/manager_pgsql.php:1.5 pear/MDB/manager_pgsql.php:1.6
--- pear/MDB/manager_pgsql.php:1.5 Thu Jul 18 14:49:46 2002
+++ pear/MDB/manager_pgsql.php Sat Jul 20 20:13:46 2002
@@ -42,7 +42,7 @@
// | Author: Paul Cooper <pgc@ucecom.com> |
// +----------------------------------------------------------------------+
-// $Id: manager_pgsql.php,v 1.5 2002/07/18 18:49:46 lsmith Exp $
+// $Id: manager_pgsql.php,v 1.6 2002/07/21 00:13:46 lsmith Exp $
// MDB postgresql driver class for RDBMS management methods.
@@ -273,11 +273,7 @@
**/
function listDatabases(&$db)
{
- $result = $db->query('SELECT datname FROM pg_database');
- if (MDB::isError($result)) {
- return $result;
- }
- return $db->fetchCol($result);
+ return $db->queryCol('SELECT datname FROM pg_database', NULL,
DB_FETCHMODE_ORDERED);
}
// }}}
@@ -290,11 +286,7 @@
**/
function listUsers(&$db)
{
- $result = $db->query('SELECT usename FROM pg_user');
- if (MDB::isError($result)) {
- return $result;
- }
- return $db->fetchCol($result);
+ return $db->queryCol('SELECT usename FROM pg_user', NULL,
DB_FETCHMODE_ORDERED);
}
// }}}
@@ -320,11 +312,7 @@
AND not exists (select 1 from pg_views where viewname = c.relname)
AND not exists (select 1 from pg_user where usesysid = c.relowner)
AND c.relname !~ '^pg_'";
- $result = $db->query($sql);
- if (MDB::isError($result)) {
- return $result;
- }
- return $db->fetchCol($result);
+ return $db->queryCol($sql, NULL, DB_FETCHMODE_ORDERED);
}
// }}}
@@ -337,11 +325,7 @@
function listViews(&$db)
{
// gratuitously stolen from PEAR DB _getSpecialQuery in pgsql.php
- $result = $db->query("SELECT viewname FROM pg_views");
- if (MDB::isError($result)) {
- return $result;
- }
- return $db->fetchCol($result);
+ return $db->queryCol("SELECT viewname FROM pg_views", NULL,
DB_FETCHMODE_ORDERED);
}
// }}}
Index: pear/MDB/manager_mysql.php
diff -u pear/MDB/manager_mysql.php:1.10 pear/MDB/manager_mysql.php:1.11
--- pear/MDB/manager_mysql.php:1.10 Sat Jul 20 15:27:15 2002
+++ pear/MDB/manager_mysql.php Sat Jul 20 20:13:47 2002
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@dybnet.de> |
// +----------------------------------------------------------------------+
//
-// $Id: manager_mysql.php,v 1.10 2002/07/20 19:27:15 lsmith Exp $
+// $Id: manager_mysql.php,v 1.11 2002/07/21 00:13:47 lsmith Exp $
//
// MDB mysql driver class for RDBMS management methods.
//
@@ -361,7 +361,7 @@
*/
function listDatabases(&$db)
{
- $result = $db->queryCol("SHOW DATABASES");
+ $result = $db->queryCol("SHOW DATABASES", NULL, DB_FETCHMODE_ORDERED);
if(MDB::isError($result)) {
return $result;
}
@@ -382,7 +382,7 @@
*/
function listUsers(&$db)
{
- $result = $db->queryCol("SELECT DISTINCT USER FROM USER");
+ $result = $db->queryCol("SELECT DISTINCT USER FROM USER", NULL,
DB_FETCHMODE_ORDERED);
if(MDB::isError($result)) {
return $result;
}
@@ -403,7 +403,7 @@
*/
function listTables(&$db)
{
- $result = $db->queryCol("SHOW TABLES");
+ $result = $db->queryCol("SHOW TABLES", NULL, DB_FETCHMODE_ORDERED);
if(MDB::isError($result)) {
return $result;
}
@@ -711,7 +711,7 @@
$db->freeResult($result);
return $db->raiseError(DB_ERROR_MANAGER, "", "", 'List
table indexes: show index does not return the table index names');
}
- $indexes_all = $db->fetchCol($result, DB_FETCHMODE_ORDERED, $columns["key_name"]);
+ $indexes_all = $db->fetchCol($result, DB_FETCHMODE_ORDERED,
$columns["key_name"]);
for($found = $indexes = array(), $index = 0; $index < count($indexes_all); $index++)
{
if ($indexes_all[$index] != "PRIMARY"
@@ -767,9 +767,9 @@
$collation_column = $columns["collation"];
$definition = array();
while (is_array($row = $db->fetchInto($result))) {
- $key_name = $row[$key_name_column];
- if(!strcmp($index_name, $key_name)) {
- if(!$row[$non_unique_column]) {
+ $key_name = $row[$key_name_column];
+ if(!strcmp($index_name, $key_name)) {
+ if(!$row[$non_unique_column]) {
$definition["unique"] = 1;
}
$column_name = $row[$column_name_column];
@@ -860,7 +860,7 @@
*/
function listSequences(&$db)
{
- $result = $db->queryCol("SHOW TABLES");
+ $result = $db->queryCol("SHOW TABLES", NULL, DB_FETCHMODE_ORDERED);
if(MDB::isError($result)) {
return $result;
}
@@ -887,7 +887,7 @@
*/
function getSequenceDefinition(&$db, $sequence)
{
- if(MDB::isError($table_names = $db->queryCol("SHOW TABLES"))) {
+ if(MDB::isError($table_names = $db->queryCol("SHOW TABLES", NULL,
DB_FETCHMODE_ORDERED))) {
return($table_names);
}
for($i = 0, $j = count($table_names); $i < $j; $i++) {