mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #12: Fix TDBConnection.ApplyLimitClause for SQLite, which does not support a LIMIT clause in UPDATE/DELETE statements
This commit is contained in:
@ -6090,7 +6090,7 @@ begin
|
|||||||
Result := Result + 'TOP '+IntToStr(Limit)+' ';
|
Result := Result + 'TOP '+IntToStr(Limit)+' ';
|
||||||
Result := Result + QueryBody;
|
Result := Result + QueryBody;
|
||||||
end;
|
end;
|
||||||
ngMySQL, ngSQLite: begin
|
ngMySQL: begin
|
||||||
Result := Result + QueryBody + ' LIMIT ';
|
Result := Result + QueryBody + ' LIMIT ';
|
||||||
if Offset > 0 then
|
if Offset > 0 then
|
||||||
Result := Result + IntToStr(Offset) + ', ';
|
Result := Result + IntToStr(Offset) + ', ';
|
||||||
@ -6104,6 +6104,17 @@ begin
|
|||||||
end else
|
end else
|
||||||
Result := Result + QueryBody;
|
Result := Result + QueryBody;
|
||||||
end;
|
end;
|
||||||
|
ngSQLite: begin
|
||||||
|
// LIMIT supported only in SELECT queries
|
||||||
|
// For UPDATEs and DELETEs only if we would compile sqlite library with SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile flag
|
||||||
|
Result := Result + QueryBody;
|
||||||
|
if Result.StartsWith('SELECT') then begin
|
||||||
|
Result := Result + ' LIMIT ';
|
||||||
|
if Offset > 0 then
|
||||||
|
Result := Result + IntToStr(Offset) + ', ';
|
||||||
|
Result := Result + IntToStr(Limit);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user