Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2000121

Odp: [PHP-DB] <PK><FK> From: Jarek Zgoda (jarekz <email protected>)
Date: 12/11/00

Od: "Anthony Martin" <Anthony <email protected>>
Temat: [PHP-DB] <PK><FK>

> I'm having trouble figuring out this referential logic. I'm writing a
> rudimentary directory structure for dividing HTML sections from one
another.
> Right now, my tables have no referential integrity, except for ones
> pertaining outside the directory structure (those being profiles and
> groups). My problem is that I cannot find a way to declare primary keys
and
> hence foreign keys yet maintain the functionality I'm looking for.
>
[snipped some code]
>
> The answer is staring me in the face: use artificial primary keys. But
I've
> gotten away with avoiding them for the whole project. As you can see, I
> avoid artificial primary keys by using the depth and name combination.
But
> in order to have multiple directory entries in the same depth, I have to
> allow non-unique entries. To allow non-unique entries, I can't have
primary
> keys. If I can't have primary keys, I can't have foreign keys pointing to
> them.

This depends one-from-another: if you can not declare PK, you will not have
FK - sad but true, it's a limitation of SQL-92.
Try to force RI using triggers but it will be slower - and more painful.

Cheers
Jarek Zgoda

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>