mirror of
https://github.com/vrana/adminer.git
synced 2025-08-11 17:14:07 +02:00
Use namespace in callbacks
This commit is contained in:
@@ -406,7 +406,7 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row) {
|
||||
}
|
||||
|
||||
function drop_databases($databases) {
|
||||
return queries("DROP DATABASE " . implode(", ", array_map('idf_escape', $databases)));
|
||||
return queries("DROP DATABASE " . implode(", ", array_map('Adminer\idf_escape', $databases)));
|
||||
}
|
||||
|
||||
function rename_database($name, $collation) {
|
||||
@@ -536,11 +536,11 @@ WHERE OBJECT_NAME(i.object_id) = " . q($table), $connection2) as $row) {
|
||||
}
|
||||
|
||||
function drop_views($views) {
|
||||
return queries("DROP VIEW " . implode(", ", array_map('table', $views)));
|
||||
return queries("DROP VIEW " . implode(", ", array_map('Adminer\table', $views)));
|
||||
}
|
||||
|
||||
function drop_tables($tables) {
|
||||
return queries("DROP TABLE " . implode(", ", array_map('table', $tables)));
|
||||
return queries("DROP TABLE " . implode(", ", array_map('Adminer\table', $tables)));
|
||||
}
|
||||
|
||||
function move_tables($tables, $views, $target) {
|
||||
|
@@ -621,8 +621,8 @@ if (!defined("DRIVER")) {
|
||||
$return[idf_unescape($match[1])] = array(
|
||||
"db" => idf_unescape($match[4] != "" ? $match[3] : $match[4]),
|
||||
"table" => idf_unescape($match[4] != "" ? $match[4] : $match[3]),
|
||||
"source" => array_map('idf_unescape', $source[0]),
|
||||
"target" => array_map('idf_unescape', $target[0]),
|
||||
"source" => array_map('Adminer\idf_unescape', $source[0]),
|
||||
"target" => array_map('Adminer\idf_unescape', $target[0]),
|
||||
"on_delete" => ($match[6] ? $match[6] : "RESTRICT"),
|
||||
"on_update" => ($match[7] ? $match[7] : "RESTRICT"),
|
||||
);
|
||||
@@ -805,7 +805,7 @@ if (!defined("DRIVER")) {
|
||||
* @return bool
|
||||
*/
|
||||
function drop_views($views) {
|
||||
return queries("DROP VIEW " . implode(", ", array_map('table', $views)));
|
||||
return queries("DROP VIEW " . implode(", ", array_map('Adminer\table', $views)));
|
||||
}
|
||||
|
||||
/** Drop tables
|
||||
@@ -813,7 +813,7 @@ if (!defined("DRIVER")) {
|
||||
* @return bool
|
||||
*/
|
||||
function drop_tables($tables) {
|
||||
return queries("DROP TABLE " . implode(", ", array_map('table', $tables)));
|
||||
return queries("DROP TABLE " . implode(", ", array_map('Adminer\table', $tables)));
|
||||
}
|
||||
|
||||
/** Move tables to other schema
|
||||
@@ -934,7 +934,7 @@ if (!defined("DRIVER")) {
|
||||
$fields[] = array(
|
||||
"field" => str_replace("``", "`", $param[2]) . $param[3],
|
||||
"type" => strtolower($param[5]),
|
||||
"length" => preg_replace_callback("~$enum_length~s", 'normalize_enum', $param[6]),
|
||||
"length" => preg_replace_callback("~$enum_length~s", 'Adminer\normalize_enum', $param[6]),
|
||||
"unsigned" => strtolower(preg_replace('~\s+~', ' ', trim("$param[8] $param[7]"))),
|
||||
"null" => 1,
|
||||
"full_type" => $param[4],
|
||||
|
@@ -455,12 +455,12 @@ WHERE conrelid = (SELECT pc.oid FROM pg_class AS pc INNER JOIN pg_namespace AS p
|
||||
AND contype = 'f'::char
|
||||
ORDER BY conkey, conname") as $row) {
|
||||
if (preg_match('~FOREIGN KEY\s*\((.+)\)\s*REFERENCES (.+)\((.+)\)(.*)$~iA', $row['definition'], $match)) {
|
||||
$row['source'] = array_map('idf_unescape', array_map('trim', explode(',', $match[1])));
|
||||
$row['source'] = array_map('Adminer\idf_unescape', array_map('trim', explode(',', $match[1])));
|
||||
if (preg_match('~^(("([^"]|"")+"|[^"]+)\.)?"?("([^"]|"")+"|[^"]+)$~', $match[2], $match2)) {
|
||||
$row['ns'] = idf_unescape($match2[2]);
|
||||
$row['table'] = idf_unescape($match2[4]);
|
||||
}
|
||||
$row['target'] = array_map('idf_unescape', array_map('trim', explode(',', $match[3])));
|
||||
$row['target'] = array_map('Adminer\idf_unescape', array_map('trim', explode(',', $match[3])));
|
||||
$row['on_delete'] = (preg_match("~ON DELETE ($on_actions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION');
|
||||
$row['on_update'] = (preg_match("~ON UPDATE ($on_actions)~", $match[4], $match2) ? $match2[1] : 'NO ACTION');
|
||||
$return[$row['conname']] = $row;
|
||||
@@ -610,7 +610,7 @@ ORDER BY conkey, conname") as $row) {
|
||||
}
|
||||
|
||||
function truncate_tables($tables) {
|
||||
return queries("TRUNCATE " . implode(", ", array_map('table', $tables)));
|
||||
return queries("TRUNCATE " . implode(", ", array_map('Adminer\table', $tables)));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -834,7 +834,7 @@ AND typelem = 0"
|
||||
foreach (indexes($table) as $index_name => $index) {
|
||||
if ($index['type'] == 'PRIMARY') {
|
||||
$primary = $index_name;
|
||||
$return_parts[] = "CONSTRAINT " . idf_escape($index_name) . " PRIMARY KEY (" . implode(', ', array_map('idf_escape', $index['columns'])) . ")";
|
||||
$return_parts[] = "CONSTRAINT " . idf_escape($index_name) . " PRIMARY KEY (" . implode(', ', array_map('Adminer\idf_escape', $index['columns'])) . ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -529,7 +529,7 @@ if (isset($_GET["sqlite"])) {
|
||||
return false;
|
||||
}
|
||||
if ($table != "") {
|
||||
if ($originals && !queries("INSERT INTO " . table($temp_name) . " (" . implode(", ", $originals) . ") SELECT " . implode(", ", array_map('idf_escape', array_keys($originals))) . " FROM " . table($table))) {
|
||||
if ($originals && !queries("INSERT INTO " . table($temp_name) . " (" . implode(", ", $originals) . ") SELECT " . implode(", ", array_map('Adminer\idf_escape', array_keys($originals))) . " FROM " . table($table))) {
|
||||
return false;
|
||||
}
|
||||
$triggers = array();
|
||||
@@ -665,7 +665,7 @@ if (isset($_GET["sqlite"])) {
|
||||
if ($name == '') {
|
||||
continue;
|
||||
}
|
||||
$return .= ";\n\n" . index_sql($table, $index['type'], $name, "(" . implode(", ", array_map('idf_escape', $index['columns'])) . ")");
|
||||
$return .= ";\n\n" . index_sql($table, $index['type'], $name, "(" . implode(", ", array_map('Adminer\idf_escape', $index['columns'])) . ")");
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user