mirror of
https://github.com/vrana/adminer.git
synced 2025-08-09 08:06:59 +02:00
Don't use LIMIT 1 if updating unique row (bug #3613109)
This commit is contained in:
@@ -17,8 +17,17 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
||||
$location = ME . "select=" . urlencode($TABLE);
|
||||
}
|
||||
|
||||
$indexes = indexes($TABLE);
|
||||
$unique_array = unique_array($_GET["where"], $indexes);
|
||||
$query_where = "\nWHERE $where";
|
||||
|
||||
if (isset($_POST["delete"])) {
|
||||
query_redirect("DELETE" . limit1("FROM " . table($TABLE), " WHERE $where"), $location, lang('Item has been deleted.'));
|
||||
$query = "FROM " . table($TABLE);
|
||||
query_redirect(
|
||||
"DELETE" . ($unique_array ? " $query$query_where" : limit1($query, $query_where)),
|
||||
$location,
|
||||
lang('Item has been deleted.')
|
||||
);
|
||||
} else {
|
||||
$set = array();
|
||||
foreach ($fields as $name => $field) {
|
||||
@@ -32,7 +41,12 @@ if ($_POST && !$error && !isset($_GET["select"])) {
|
||||
if (!$set) {
|
||||
redirect($location);
|
||||
}
|
||||
query_redirect("UPDATE" . limit1(table($TABLE) . " SET" . implode(",", $set), "\nWHERE $where"), $location, lang('Item has been updated.'));
|
||||
$query = table($TABLE) . " SET" . implode(",", $set);
|
||||
query_redirect(
|
||||
"UPDATE" . ($unique_array ? " $query$query_where" : limit1($query, $query_where)),
|
||||
$location,
|
||||
lang('Item has been updated.')
|
||||
);
|
||||
} else {
|
||||
$result = insert_into($TABLE, $set);
|
||||
$last_id = ($result ? last_id() : 0);
|
||||
|
Reference in New Issue
Block a user