Odp: [PHP-DB] <PK><FK>
| From: | signup | Date: | Mon, 22 Jan 2001 21:38:23 +0000 |
| Subject: | Odp: [PHP-DB] <PK><FK> | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-6100@lists.php.net to get a copy of this message | ||
Od: "Anthony Martin" <Anthony@TRAMS.com>
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@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net