1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-16 11:34:10 +02:00

Schema support for PostgreSQL

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1521 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
jakubvrana
2010-05-05 16:30:55 +00:00
parent 4809139347
commit 6420c5848c
16 changed files with 255 additions and 144 deletions

View File

@@ -490,7 +490,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . $connection->quote($table)
}
function support($feature) {
return ereg('^(trigger|drop_col)$', $feature); //! view|routine|
return ereg('^(trigger|drop_col)$', $feature); //! view|routine|scheme|
}
$driver = "mssql";

View File

@@ -755,6 +755,28 @@ if (!defined("DRIVER")) {
return $connection->query("EXPLAIN $query");
}
/** Get existing schemas
* @return array
*/
function schemas() {
return array();
}
/** Get current schema
* @return string
*/
function get_schema() {
return "";
}
/** Set current schema
* @param string
* @return bool
*/
function set_schema($schema) {
return true;
}
/** Get SQL command to create table
* @param string
* @return string
@@ -810,7 +832,7 @@ if (!defined("DRIVER")) {
*/
function support($feature) {
global $connection;
return ($connection->server_info >= 5.1 || ($connection->server_info >= 5 && !ereg("event|partitioning")) || !ereg("view|routine|trigger"));
return !ereg("scheme" . ($connection->server_info < 5.1 ? "|event|partitioning" . ($connection->server_info < 5 ? "|view|routine|trigger" : "") : ""), $feature);
}
$driver = "sql"; ///< @var string JUSH identifier

View File

@@ -452,12 +452,26 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . $connection->qu
return $connection->query("EXPLAIN $query");
}
function schemas() {
return get_vals("SELECT nspname FROM pg_namespace");
}
function get_schema() {
global $connection;
return $connection->result("SELECT current_schema()");
}
function set_schema($schema) {
global $connection;
return $connection->query("SET search_path TO " . idf_escape($schema));
}
function use_sql($database) {
return "\connect " . idf_escape($database);
}
function support($feature) {
return ereg('^(comment|view|trigger|drop_col)$', $feature); //! routine|
return ereg('^(comment|view|scheme|trigger|drop_col)$', $feature); //! routine|sequence|
}
$driver = "pgsql";

View File

@@ -496,6 +496,18 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
return $connection->query("EXPLAIN $query");
}
function schemas() {
return array();
}
function get_schema() {
return "";
}
function set_schema($scheme) {
return true;
}
function create_sql($table) {
global $connection;
return $connection->result("SELECT sql FROM sqlite_master WHERE type = 'table' AND name = " . $connection->quote($table));