On Fri, 11 Dec 2009 05:05:49 -0500, <wcl...@gfs-hofheim.de> wrote:

> I hope I'm not duplicating a request already made by someone, but it'd be
> great if the foreign keys flag can be set as a compile option (like the
> recursive triggers flag).

At the least, it is a request that someone has been *intending* to make.  By 
the way, SQLITE_DEFAULT_RECURSIVE_TRIGGERS is not documented at 
<http://www.sqlite.org/compile.html>.

For those working from the amalgamation and willing to live dangerously, 
insertions are needed at 3.6.21 sqlite3.c original lines 96740 and 6633. 
(Jump to 96737 and 6629 for context.)  With a 3.65MiB source file, an 
efficient text editor is recommended.  According to the shell, it appears to 
work beautifully:

>sqlite3
SQLite version 3.6.21
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA foreign_keys;
1
sqlite> PRAGMA recursive_triggers;
1
sqlite>

To some of us who use SQLite and care deeply for referential integrity, Dr. 
Hipp’s October 8 surprise announcement of native foreign key enforcement has 
thus far been one of 2009’s two biggest pieces of software-industry news. 
(The other was the release of Windows 7.)  That speaks both to the state of 
the software industry, and to the critical import of foreign key 
enforcement.

Samuel Adam


> As a simple patch that I hope can be merged into the next release (made
> against the sources for 3.6.21)...
>
>
> diff U3 main.c main.c
> --- main.c      Fri Dec 11 10:51:37 2009
> +++ main.c      Fri Dec 11 10:44:06 2009
> @@ -1603,6 +1603,9 @@
>  #if SQLITE_DEFAULT_RECURSIVE_TRIGGERS
>                   | SQLITE_RecTriggers
>  #endif
> +#if SQLITE_DEFAULT_FOREIGN_KEYS
> +                 | SQLITE_ForeignKeys
> +#endif
>        ;
>    sqlite3HashInit(&db->aCollSeq);
>  #ifndef SQLITE_OMIT_VIRTUALTABLE
> diff U3 sqliteInt.h sqliteInt.h
> --- sqliteInt.h Fri Dec 11 10:51:37 2009
> +++ sqliteInt.h Fri Dec 11 10:44:09 2009
> @@ -357,6 +357,10 @@
>  # define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0
>  #endif
>+#ifndef SQLITE_DEFAULT_FOREIGN_KEYS
> +# define SQLITE_DEFAULT_FOREIGN_KEYS 0
> +#endif
> +
>  /*
>  ** Provide a default value for SQLITE_TEMP_STORE in case it is not
> specified
>  ** on the command-line
 

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to