Fix posgres tests

This commit is contained in:
Timothy Warren 2012-04-10 08:04:38 -04:00
parent 851ff0b916
commit 57842a44b4
4 changed files with 89 additions and 0 deletions

View File

@ -72,5 +72,61 @@ abstract class DB_SQL {
* @return string * @return string
*/ */
abstract public function backup_data(); abstract public function backup_data();
/**
* Returns sql to list other databases
*
* @return string
*/
abstract public function db_list();
/**
* Returns sql to list tables
*
* @return string
*/
abstract public function table_list();
/**
* Returns sql to list system tables
*
* @return string
*/
abstract public function system_table_list();
/**
* Returns sql to list views
*
* @return string
*/
abstract public function view_list();
/**
* Returns sql to list triggers
*
* @return string
*/
abstract public function trigger_list();
/**
* Return sql to list functions
*
* @return FALSE
*/
abstract public function function_list();
/**
* Return sql to list stored procedures
*
* @return string
*/
abstract public function procedure_list();
/**
* Return sql to list sequences
*
* @return string
*/
abstract public function sequence_list();
} }
// End of db_sql.php // End of db_sql.php

View File

@ -73,5 +73,23 @@ class pgSQL extends DB_PDO {
{ {
return (isset($this->statement)) ? $this->statement->rowCount : FALSE; return (isset($this->statement)) ? $this->statement->rowCount : FALSE;
} }
// --------------------------------------------------------------------------
/**
* Get a list of schemas for the current connection
*
* @return array
*/
public function get_schemas()
{
$sql = <<<SQL
SELECT DISTINCT "schemaname" FROM "pg_tables"
WHERE "schemaname" NOT LIKE 'pg\_%'
AND "schemaname" != 'information_schema'
SQL;
return $this->driver_query($sql);
}
} }
//End of pgsql_driver.php //End of pgsql_driver.php

View File

@ -17,6 +17,15 @@
*/ */
class pgSQL_SQL extends DB_SQL { class pgSQL_SQL extends DB_SQL {
/**
* Database-specific method to create a new table
*
* @param string $name
* @param array $columns
* @param array $constraints
* @param array $indexes
* @return string
*/
public function create_table($name, $columns, array $constraints=array(), array $indexes=array()) public function create_table($name, $columns, array $constraints=array(), array $indexes=array())
{ {
$column_array = array(); $column_array = array();
@ -67,6 +76,12 @@ class pgSQL_SQL extends DB_SQL {
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
/**
* Database-specific SQL for dropping a table
*
* @param string $name
* @return string
*/
public function delete_table($name) public function delete_table($name)
{ {
return 'DROP TABLE "'.$name.'"'; return 'DROP TABLE "'.$name.'"';

Binary file not shown.