cvs: pear /MDB manager_mysql.php
| From: | Lukas Smith | Date: | Wed, 12 Jun 2002 12:49:27 +0000 |
| Subject: | cvs: pear /MDB manager_mysql.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4566@lists.php.net to get a copy of this message | ||
lsmith Wed Jun 12 08:49:27 2002 EDT
Modified files:
/pear/MDB manager_mysql.php
Log:
added listUsers, listViews and listFunctions
Index: pear/MDB/manager_mysql.php
diff -u pear/MDB/manager_mysql.php:1.3 pear/MDB/manager_mysql.php:1.4
--- pear/MDB/manager_mysql.php:1.3 Wed Jun 5 10:17:32 2002
+++ pear/MDB/manager_mysql.php Wed Jun 12 08:49:27 2002
@@ -6,13 +6,13 @@
/*
* manager_mysql.php
*
- * @(#) $Header: /usr/repository/pear/MDB/manager_mysql.php,v 1.3 2002/06/05 14:17:32 lsmith Exp $
+ * @(#) $Header: /usr/repository/pear/MDB/manager_mysql.php,v 1.4 2002/06/12 12:49:27 lsmith Exp $
*
*/
class MDB_manager_mysql_class extends MDB_manager_database_class
{
- function createDatabase(&$db,$name)
+ function createDatabase(&$db, $name)
{
if (MDB::isError($result = $db->connect())) {
return $result;
@@ -21,10 +21,10 @@
return $db->mysqlRaiseError(DB_ERROR_CANNOT_CREATE);
}
- return (1);
+ return (DB_OK);
}
- function dropDatabase(&$db,$name)
+ function dropDatabase(&$db, $name)
{
if (MDB::isError($result = $db->connect())) {
return $result;
@@ -32,7 +32,7 @@
if (!mysql_drop_db($name, $this->connection)) {
return $db->mysqlRaiseError(DB_ERROR_CANNOT_DROP);
}
- return (1);
+ return (DB_OK);
}
function createTable(&$db, $name, &$fields)
@@ -73,7 +73,7 @@
'Alter table: change type "'.Key($changes).'"
not yet supported');
}
}
- return (1);
+ return (DB_OK);
} else {
$query = (isset($changes["name"]) ? "RENAME AS
".$changes["name"] : "");
if (isset($changes["AddedFields"])) {
@@ -145,6 +145,24 @@
}
}
+ function listDatabases(&$db, &$dbs)
+ {
+ $result = $db->queryCol("SHOW DATABASES", $dbs);
+ if(MDB::isError($result)) {
+ return $result;
+ }
+ return(1);
+ }
+
+ function listUsers(&$db, &$users)
+ {
+ $result = $db->queryCol("SELECT DISTINCT USER FROM USER", $users);
+ if(MDB::isError($result)) {
+ return $result;
+ }
+ return(1);
+ }
+
function listTables(&$db, &$tables)
{
$result = $db->queryCol("SHOW TABLES", $table_names);
@@ -316,7 +334,7 @@
}
}
$db->freeResult($result);
- return(1);
+ return(DB_OK);
}
}
if(!$db->autofree) {
@@ -371,7 +389,7 @@
if ($field>0) {
$query .= ",";
}
- $query .= Key($definition["FIELDS"]);
+ $query .= key($definition["FIELDS"]);
}
$query .= ")";
return ($db->query($query));