mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Use different TOP syntax for UPDATE + SELECT queries in MS SQL. Fixes issue #2682.
This commit is contained in:
@@ -3113,14 +3113,20 @@ end;
|
||||
function TDBConnection.ApplyLimitClause(QueryType, QueryBody: String; Limit, Offset: Cardinal): String;
|
||||
begin
|
||||
Result := QueryType + ' ';
|
||||
if FParameters.NetTypeGroup = ngMSSQL then
|
||||
Result := Result + 'TOP '+IntToStr(Limit)+' ';
|
||||
Result := Result + QueryBody;
|
||||
if FParameters.NetTypeGroup = ngMySQL then begin
|
||||
Result := Result + ' LIMIT ';
|
||||
if Offset > 0 then
|
||||
Result := Result + IntToStr(Offset) + ', ';
|
||||
Result := Result + IntToStr(Limit);
|
||||
case FParameters.NetTypeGroup of
|
||||
ngMSSQL: begin
|
||||
if UpperCase(QueryType) = 'UPDATE' then
|
||||
Result := Result + 'TOP('+IntToStr(Limit)+') '
|
||||
else
|
||||
Result := Result + 'TOP '+IntToStr(Limit)+' ';
|
||||
Result := Result + QueryBody;
|
||||
end;
|
||||
ngMySQL: begin
|
||||
Result := Result + QueryBody + ' LIMIT ';
|
||||
if Offset > 0 then
|
||||
Result := Result + IntToStr(Offset) + ', ';
|
||||
Result := Result + IntToStr(Limit);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user