Fix abstract method again, add get_dbs to pgsql driver

This commit is contained in:
Timothy Warren 2012-02-06 16:17:14 -05:00
parent b0da1994f5
commit ef4a84c2d0
3 changed files with 17 additions and 1 deletions

1
.gitignore vendored
View File

@ -2,4 +2,5 @@
*.DS_Store *.DS_Store
settings.json settings.json
errors.txt errors.txt
*/simpletest/*

View File

@ -111,7 +111,7 @@ abstract class DB_PDO extends PDO {
/** /**
* Abstract functions to override in child classes * Abstract functions to override in child classes
*/ */
abstract function get_dbs(); abstract function get_tables();
} }
// End of db_pdo.php // End of db_pdo.php

View File

@ -43,6 +43,21 @@ class pgSQL extends DB_PDO {
$this->query($sql); $this->query($sql);
} }
/**
* Get list of databases for the current connection
*
* @return array
*/
function get_dbs()
{
$sql = "SELECT datname FROM pg_database WHERE datname NOT IN ('template0','template1') ORDER BY 1";
$res = $this->query($sql);
$dbs = $res->fetchAll(PDO::FETCH_ASSOC);
return $dbs;
}
/** /**
* Get the list of tables for the current db * Get the list of tables for the current db
* *