Lazarus 2.0.0.RC3 - Sequence does not work properly for SQLite lazarus / 16-Databases ---------------------------------------------------------------------- Patro de Nordo · 2019-02-01 10:10 Method TSQLConnection.GetNextValueSQL implemented is follows: (sqldb.pp) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TSQLite3Connection.GetNextValueSQL(const SequenceName: string; IncrementBy: Integer): string;begin  Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=''' + SequenceName+'''';end; ---------------------------------------------------------------------- madref · 2019-02-01 22:45 The error starts with the 3 quotes after each other. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TSQLite3Connection.GetNextValueSQL(const SequenceName: string; IncrementBy: Integer): string;begin  Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=''' + SequenceName+'''';end; Instead use chr (34) double quote or chr(39) single quote Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function SingleQuotedStr (St: String) : String;begin  Result := Chr(39)+ St + Chr(39);end;    // SingleQuotedStrCode: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function DoubleQuotedStr (St: String) : String;begin  Result := Chr(34)+ St + Chr(34);end;    // DoubleQuotedStr So your result is then Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=' + DoubleQuoteStr(SequenceName); ---------------------------------------------------------------------- Patro de Nordo · 2019-02-04 06:57 Quote from: madref on February 01, 2019, 11:45:49 pmThe error starts with the 3 quotes after each other. You're wrong. I showed a workable code. String values must be framed in single quotes in SQL. A single quote can be entered into pascal  string by double single quote. Thus, the following expressions are equivalent: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=' + SingleQuoteStr(SequenceName); and Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i  Result := 'SELECT seq+1 FROM sqlite_sequence WHERE name=''' + SequenceName+'''';