mirror of
https://github.com/vrana/adminer.git
synced 2025-08-23 22:52:51 +02:00
Detect prefix from grants
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@263 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -39,7 +39,16 @@ if ($_POST) {
|
|||||||
} else {
|
} else {
|
||||||
$name = $_GET["db"];
|
$name = $_GET["db"];
|
||||||
$collate = array();
|
$collate = array();
|
||||||
if (strlen($_GET["db"]) && ($result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
|
if (!strlen($_GET["db"])) {
|
||||||
|
$result = $mysql->query("SHOW GRANTS");
|
||||||
|
while ($row = $result->fetch_row()) {
|
||||||
|
if (preg_match('~ ON (`(([^\\\\`]+|``|\\\\.)*)%`\\.\\*)?~', $row[0], $match) && $match[1]) {
|
||||||
|
$name = stripcslashes(idf_unescape($match[2]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result->free();
|
||||||
|
} elseif (($result = $mysql->query("SHOW CREATE DATABASE " . idf_escape($_GET["db"])))) {
|
||||||
$create = $mysql->result($result, 1);
|
$create = $mysql->result($result, 1);
|
||||||
if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) {
|
if (preg_match('~ COLLATE ([^ ]+)~', $create, $match)) {
|
||||||
$collate = $match[1];
|
$collate = $match[1];
|
||||||
|
Reference in New Issue
Block a user