Method TSQLConnection.GetNextValueSQL implemented is follows:
(sqldb.pp)
function TSQLConnection.GetNextValueSQL(const SequenceName: string; IncrementBy: Integer): string;
begin
Result := 'SELECT NEXT VALUE FOR ' + SequenceName;
end;
This query is incorrect for SQLite. But method not overriden for TSQLite3Connection.
This causes an error "
near "FOR": syntax error" when trying to use sequences in TSQLQuery.
The following query can be used for SQLite:
function TSQLite3Connection.GetNextValueSQL(const SequenceName: string; IncrementBy: Integer): string;
begin
Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=''' + SequenceName+'''';
end;