diff --git a/.gitignore b/.gitignore index e042d7c..b10d5da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ *.DS_Store settings.json errors.txt +*/simpletest/* diff --git a/src/databases/db_pdo.php b/src/databases/db_pdo.php index ca8a8e1..5734713 100644 --- a/src/databases/db_pdo.php +++ b/src/databases/db_pdo.php @@ -111,7 +111,7 @@ abstract class DB_PDO extends PDO { /** * Abstract functions to override in child classes */ - abstract function get_dbs(); + abstract function get_tables(); } // End of db_pdo.php \ No newline at end of file diff --git a/src/databases/pgsql.php b/src/databases/pgsql.php index fb520e7..eda0835 100644 --- a/src/databases/pgsql.php +++ b/src/databases/pgsql.php @@ -43,6 +43,21 @@ class pgSQL extends DB_PDO { $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 *