Selaa lähdekoodia

* Patch from Ludo, Foreign key support for SQLite option. Mantis #20865

git-svn-id: trunk@19872 -
marco 13 vuotta sitten
vanhempi
commit
0b655b19d9
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  1. 7 0
      packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

+ 7 - 0
packages/fcl-db/src/sqldb/sqlite/sqlite3conn.pp

@@ -16,6 +16,11 @@
 { 
   Based on an implementation by Martin Schreiber, part of MSEIDE.
   Reworked all code so it conforms to FCL coding standards.
+
+  TSQLite3Connection properties
+      Params - "foreign_keys=ON" - enable foreign key support for this connection:
+                                   http://www.sqlite.org/foreignkeys.html#fk_enable
+
 } 
  
 unit sqlite3conn;
@@ -708,6 +713,8 @@ begin
   InitializeSqlite(SQLiteLibraryName);
   str1:= databasename;
   checkerror(sqlite3_open(pchar(str1),@fhandle));
+  if Params.IndexOfName('foreign_keys') <> -1 then
+    execsql('PRAGMA foreign_keys =  '+Params.Values['foreign_keys']);
 end;
 
 procedure TSQLite3Connection.DoInternalDisconnect;