From: Tim Düsterhus Date: Sun, 14 Jun 2015 13:21:50 +0000 (+0200) Subject: Properly support FOR UPDATE + LIMIT X-Git-Tag: 3.0.0_Beta_1~2249^2~3^2~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8439918f4857a3da050e112c9526cd758c6210e;p=GitHub%2FWoltLab%2FWCF.git Properly support FOR UPDATE + LIMIT --- diff --git a/wcfsetup/install/files/lib/system/database/Database.class.php b/wcfsetup/install/files/lib/system/database/Database.class.php index bf319f9fb9..fba3294d3b 100644 --- a/wcfsetup/install/files/lib/system/database/Database.class.php +++ b/wcfsetup/install/files/lib/system/database/Database.class.php @@ -244,7 +244,7 @@ abstract class Database { */ public function handleLimitParameter($query, $limit = 0, $offset = 0) { if ($limit != 0) { - $query .= " LIMIT " . $limit . ($offset ? " OFFSET " . $offset : ''); + $query = preg_replace('~(\s+FOR\s+UPDATE\s*)?$~', " LIMIT " . $limit . ($offset ? " OFFSET " . $offset : '') . "\\0", $query, 1); } return $query;