Re: [sqlite] Question about Referential IntegrityRE: Foreign key support

2009-02-23 Thread Yves Goergen
On 12.02.2009 06:23 CE(S)T, Roger Binns wrote:
> It is true that triggers can be used to achieve referential integrity.
> However you don't have to hand craft them.  The front page of the wiki
> links to the document explaining it:
> 
>   http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers
> 
> But the SQLite team has already done all the work for you.  The SQLite
> source includes a program named 'genfkey' that will create the triggers.

Wow, didn't know that. Maybe because my last visit on that page is some
years ago.

So the next step is probably that the SQLite engine does all that on its
own, how would that be? :-)

-- 
Yves Goergen "LonelyPixel" 
Visit my web laboratory at http://beta.unclassified.de
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question about Referential IntegrityRE: Foreign key support

2009-02-11 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Yves Goergen wrote:
> You can already use referential integrity with SQLite - just in a very
> complicated way, using numerous handcrafted triggers. How it works is
> documented somewhere in the Wiki, IIRC.

It is true that triggers can be used to achieve referential integrity.
However you don't have to hand craft them.  The front page of the wiki
links to the document explaining it:

  http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers

But the SQLite team has already done all the work for you.  The SQLite
source includes a program named 'genfkey' that will create the triggers.
 You can simply do:

   genfkey ./test.db | sqlite3 ./test.db

Just run it again if you change your schema and it will drop the old
triggers and supply new ones (by default).  This is the README:

  http://www.sqlite.org/cvstrac/fileview?f=sqlite/tool/genfkey.README

You can find the program in the tool subdirectory if you CVS checkout
the SQLite code, or grab it using a browser from:

  http://www.sqlite.org/cvstrac/dir?d=sqlite/tool

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkmTsjEACgkQmOOfHg372QSnQQCfUTQn0DaSwplXm/Gq8lSbAoXw
eU0An1ygaYUSZhtifTz37fybb+A8MbBS
=EUri
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question about Referential IntegrityRE: Foreign key support

2009-02-11 Thread Yves Goergen
On 09.02.2009 19:32 CE(S)T, palmer ristevski wrote:
> Just wondering when/if Richard
> will make SQLite having referential Integrity a priority.
> Is it on the TODO list? Is it #1 or #100 on this TODO list.
> Because almost all other common databases have this.
>  
> Once it has this feature I think that it will become even more popular.

You can already use referential integrity with SQLite - just in a very
complicated way, using numerous handcrafted triggers. How it works is
documented somewhere in the Wiki, IIRC.

-- 
Yves Goergen "LonelyPixel" 
Visit my web laboratory at http://beta.unclassified.de
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Question about Referential IntegrityRE: Foreign key support

2009-02-09 Thread palmer ristevski

Just wondering when/if Richard
will make SQLite having referential Integrity a priority.
Is it on the TODO list? Is it #1 or #100 on this TODO list.
Because almost all other common databases have this.
 
Once it has this feature I think that it will become even more popular.
 
Signing off
Great Fan of SQLite
P.
> From: danielk1...@gmail.com> To: sqlite-users@sqlite.org> Date: Sat, 31 Jan 
> 2009 00:28:05 +0700> Subject: Re: [sqlite] Foreign key support> > > On Jan 
> 31, 2009, at 12:25 AM, Adam DeVita wrote:> > > Good day,> >> > If I write 
> into the sqlite3 using the analyzer:> >> > create table mysns (SN int primary 
> key, desc text);> > insert into mysns (SN, desc) values (1,2);> > create 
> table t2 (mynum int, desc2 text, SN references mysns(SN) );> >> > insert into 
> t2 (mynum, desc2, SN) values (1,"two", 3);> >> > This insert didn't produce 
> an error, despite the fact 3 isn't in table> > mysns. Why?> > Foreign keys 
> are not supported. See the first entry in> this list:> > 
> http://www.sqlite.org/omitted.html> > > >> >> > regards,> > Adam> > 
> ___> > sqlite-users mailing list> 
> > sqlite-users@sqlite.org> > 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users> > 
> ___> sqlite-users mailing list> 
> sqlite-users@sqlite.org> 
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_
Windows Liveā„¢: Keep your life in sync. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_022009
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users