Driver specific USE
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1471 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
a29ac72c9c
commit
58c80e369c
|
@ -666,10 +666,24 @@ if (!defined("DRIVER")) {
|
|||
return $connection->result("SHOW CREATE TABLE " . idf_escape($table), 1);
|
||||
}
|
||||
|
||||
/** Get SQL command to change database
|
||||
* @param string
|
||||
* @return string
|
||||
*/
|
||||
function use_sql($database) {
|
||||
return "USE " . idf_escape($database);
|
||||
}
|
||||
|
||||
/** Get server variables
|
||||
* @return array ($name => $value)
|
||||
*/
|
||||
function show_variables() {
|
||||
return get_key_vals("SHOW VARIABLES");
|
||||
}
|
||||
|
||||
/** Get status variables
|
||||
* @return array ($name => $value)
|
||||
*/
|
||||
function show_status() {
|
||||
return get_key_vals("SHOW STATUS");
|
||||
}
|
||||
|
|
|
@ -415,6 +415,10 @@ WHERE tc.constraint_type = 'FOREIGN KEY' AND tc.table_name = " . $connection->qu
|
|||
return $connection->query("EXPLAIN $query");
|
||||
}
|
||||
|
||||
function use_sql($database) {
|
||||
return "\connect " . idf_escape($database);
|
||||
}
|
||||
|
||||
function support($feature) {
|
||||
return ereg('^(comment|view|routine|trigger)$', $feature);
|
||||
}
|
||||
|
|
|
@ -462,6 +462,11 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) {
|
|||
return $connection->result("SELECT sql FROM sqlite_master WHERE name = " . $connection->quote($table));
|
||||
}
|
||||
|
||||
function use_sql($database) {
|
||||
global $connection;
|
||||
return "ATTACH " . $connection->quote($database) . " AS " . idf_escape($database);
|
||||
}
|
||||
|
||||
function show_variables() {
|
||||
global $connection;
|
||||
$return = array();
|
||||
|
|
|
@ -37,7 +37,7 @@ SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
|
|||
}
|
||||
if ($_POST["format"] == "sql") {
|
||||
if ($style) {
|
||||
echo "USE " . idf_escape($db) . ";\n\n";
|
||||
echo use_sql($db) . ";\n\n";
|
||||
}
|
||||
if (in_array("CREATE+ALTER", array($style, $_POST["table_style"]))) {
|
||||
echo "SET @adminer_alter = '';\n\n";
|
||||
|
|
Loading…
Reference in a new issue