RE: [sqlite] foreign keys? (sqlite3)

2005-12-08 Thread Griggs, Donald
Re: I've created a class that generates the necessary sql statements to
describe 
the primary-foreign key relationship between two tables.


Todd, I suspect there would be interest to some on the list. 

You may also want to review Cody Pisto's utility linked from page:
http://www.sqlite.org/contrib

On that page, you'll also find the instructions:
"If you would like to contribute files and need a userid and password,
send an email to [EMAIL PROTECTED] requesting one."


Donald Griggs


Opinions are not necessarily those of Misys Healthcare Systems nor its board
of directors.


RE: [sqlite] foreign keys? (sqlite3)

2005-12-07 Thread tgreenwood
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I've created a class that generates the necessary sql statements to
describe the primary-foreign key relationship between two tables. This
code is fairly rudimentary so far...

Q: Is this interesting to anyone on this list?
Q: If so, where should I post this code?

- -Todd
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDl86Qz6uXX4lQc/URAnEQAJ9siQ06U4+JoDK8wXxPlbM791M67gCgsqOm
t3CeAH8qyvTd0WmZpPpQVZ4=
=7Ryx
-END PGP SIGNATURE-


Re: [sqlite] foreign keys? (sqlite3)

2005-02-01 Thread Dick Davies
* Griggs, Donald <[EMAIL PROTECTED]> [0246 18:46]:
> 
> > -Original Message-
> > From: Dick Davies [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, February 01, 2005 3:52 PM
> > To: SQLite
> > Subject: [sqlite] foreign keys? (sqlite3)
> > 
> > 
> > The docs seem to say sqlite3 does'nt support foreign keys, is
> > that correct?

> You may find Cody Pisto's utility useful.
>   http://www.sqlite.org/contrib
> It creates sqlite triggers to enforce foreign keys.

Ah, that's what I thought - my app can handle the constraints,
it's really just the 'on cascade delete' feature I could do with the
db handling. I found this earlier:

http://www.justatheory.com/computers/databases/sqlite/

which seems to point out the voodoo needed.

Thanks for the  confirmation(s).


-- 
'Sweet Zombie Jesus!'
-- Prof. Farnsworth
Rasputin :: Jack of All Trades - Master of Nuns


RE: [sqlite] foreign keys? (sqlite3)

2005-02-01 Thread Griggs, Donald

> -Original Message-
> From: Dick Davies [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 01, 2005 3:52 PM
> To: SQLite
> Subject: [sqlite] foreign keys? (sqlite3)
> 
> 
> The docs seem to say sqlite3 does'nt support foreign keys, is
> that correct?
> 
> If so, I don't understand what [it actually does].
> 
> ---8<-


You may find Cody Pisto's utility useful.
http://www.sqlite.org/contrib
It creates sqlite triggers to enforce foreign keys.



Donald Griggs
Desk: 803-735-7834

Opinions are not necessarily those of Misys Healthcare Systems nor its board
of directors.



--


RE: [sqlite] foreign keys? (sqlite3)

2005-02-01 Thread Cariotoglou Mike
Sqlite parser DOES parse foreign key constraints. Try this:

create table t1(
id integer,
id1 integer,
id2 integer,
id3 integer,
foreign key (id1,id2) references anotherTable(id,id1),
foreign key (id3) references somethingElse(id)
);

pragma foreign_key_list(t1);

However, this does not mean that it actually DOES anything with this
info, it is just there for you to act, not for the engine (yet)

 

> -Original Message-
> From: Dick Davies [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, February 01, 2005 3:52 PM
> To: SQLite
> Subject: [sqlite] foreign keys? (sqlite3)
> 
> 
> The docs seem to say sqlite3 does'nt support foreign keys, is 
> that correct?
> 
> If so, I don't understand what 
> 
> ---8<-
> ---
> #
> PRAGMA foreign_key_list(table-name);
> 
> For each foreign key that references a column in the argument 
> table, invoke the callback function with information about 
> that foreign key.
> The callback function will be invoked once for each column in 
> each foreign key.
> ---8<-
> ---
> 
> actually does?
> 
> --
> 'The pie is ready. You guys like swarms of things, right?'
>   -- Bender
> Rasputin :: Jack of All Trades - Master of Nuns
> 
> 
> 



[sqlite] foreign keys? (sqlite3)

2005-02-01 Thread Dick Davies

The docs seem to say sqlite3 does'nt support foreign keys,
is that correct?

If so, I don't understand what 

---8<
#
PRAGMA foreign_key_list(table-name);

For each foreign key that references a column in the argument table,
invoke the callback function with information about that foreign key.
The callback function will be invoked once for each column in each foreign key.
---8<

actually does?

-- 
'The pie is ready. You guys like swarms of things, right?'
-- Bender
Rasputin :: Jack of All Trades - Master of Nuns