Permalink
Browse files

Fix LIKE backslash escaping

  • Loading branch information...
1 parent fd5e6ef commit 3cae3e2f7fdd4de06577dee4e19b5cc23d8f46c3 @vrana committed Apr 27, 2013
Showing with 4 additions and 4 deletions.
  1. +3 −3 adminer/drivers/mysql.inc.php
  2. +1 −1 adminer/user.inc.php
@@ -370,7 +370,7 @@ function count_tables($databases) {
*/
function table_status($name = "") {
$return = array();
- foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_")) : "")) as $row) {
+ foreach (get_rows("SHOW TABLE STATUS" . ($name != "" ? " LIKE " . q(addcslashes($name, "%_\\")) : "")) as $row) {
if ($row["Engine"] == "InnoDB") {
// ignore internal comment, unnecessary since MySQL 5.1.21
$row["Comment"] = preg_replace('~(?:(.+); )?InnoDB free: .*~', '\\1', $row["Comment"]);
@@ -733,7 +733,7 @@ function trigger($name) {
*/
function triggers($table) {
$return = array();
- foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_"))) as $row) {
+ foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\"))) as $row) {
$return[$row["Trigger"]] = array($row["Timing"], $row["Event"]);
}
return $return;
@@ -924,7 +924,7 @@ function use_sql($database) {
*/
function trigger_sql($table, $style) {
$return = "";
- foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_")), null, "-- ") as $row) {
+ foreach (get_rows("SHOW TRIGGERS LIKE " . q(addcslashes($table, "%_\\")), null, "-- ") as $row) {
$return .= "\n" . ($style == 'CREATE+ALTER' ? "DROP TRIGGER IF EXISTS " . idf_escape($row["Trigger"]) . ";;\n" : "")
. "CREATE TRIGGER " . idf_escape($row["Trigger"]) . " $row[Timing] $row[Event] ON " . table($row["Table"]) . " FOR EACH ROW\n$row[Statement];;\n";
}
@@ -120,7 +120,7 @@
if ($old_pass != "") {
$row["hashed"] = true;
}
- $grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_"))) . ".*"] = array();
+ $grants[(DB == "" || $grants ? "" : idf_escape(addcslashes(DB, "%_\\"))) . ".*"] = array();
}
?>

0 comments on commit 3cae3e2

Please sign in to comment.