Odp: [PHP-DB] <PK><FK>

From: Date: Mon, 11 Dec 2000 21:05:42 +0000
Subject: Odp: [PHP-DB] <PK><FK>
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-5173@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

« previous php.db (#5173) next »