sqlite foreign keys lazarus / 16-Databases ---------------------------------------------------------------------- Чебурашка · 2023-01-03 14:54 Does anybody know how to turn on FK checking in sqlite from fp? In the sqlite documentnation I see that PRAGMA foreign_keys = on has to be called every time a new connection is opened, and has not to be done within transaction. Currently I tried this 2 ways: 1. Create sqlite connection 2. Open sqlite connection 3. ExecuteDirect('PRAGMA foreign_keys = on'); This fails saying "Transaction not set." 1. Create sqlite connection 2. Open sqlite connection 3. Create a transaction, bu do not start it 3. ExecuteDirect('PRAGMA foreign_keys = on', transaction); This fails saying "Error: attempt to implicitly start a transaction on Connection "", transaction ""." Thanks ---------------------------------------------------------------------- Чебурашка · 2023-01-03 15:03 Quote from: tt on January 03, 2023, 03:54:57 pmDoes anybody know how to turn on FK checking in sqlite from fp? In the sqlite documentnation I see that PRAGMA foreign_keys = on has to be called every time a new connection is opened, and has not to be done within transaction. Currently I tried this 2 ways: 1. Create sqlite connection 2. Open sqlite connection 3. ExecuteDirect('PRAGMA foreign_keys = on'); This fails saying "Transaction not set." 1. Create sqlite connection 2. Open sqlite connection 3. Create a transaction, bu do not start it 3. ExecuteDirect('PRAGMA foreign_keys = on', transaction); This fails saying "Error: attempt to implicitly start a transaction on Connection "", transaction ""." Thanks Stop, I found in 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 procedure TSQLite3Connection.DoInternalConnect;var  filename: ansistring;begin  Inherited;  if DatabaseName = '' then    DatabaseError(SErrNoDatabaseName,self);  InitializeSQLite;  filename := DatabaseName;  checkerror(sqlite3_open_v2(PAnsiChar(filename),@fhan dle,GetSQLiteOpenFlags,Nil));  if (Length(Password)>0) and assigned(sqlite3_key) then    checkerror(sqlite3_key(fhandle,PChar(Pas sword),StrLen(PChar(Password))));  if Params.IndexOfName('foreign_keys') <> -1 then    execsql('PRAGMA foreign_keys =  '+Params.Values['foreign_keys']);end;  I have to supply a 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 conn.Params.AddPair('foreign_keys', 'ON');  To much Prosecco at new year's eve. ---------------------------------------------------------------------- Чебурашка · 2023-01-03 15:14 Why not adding a small note to the wiki about this? https://wiki.freepascal.org/SQLite