Re: RE: [PEAR] liveuser status

From: Date: Fri, 19 Sep 2003 15:05:19 +0000
Subject: Re: RE: [PEAR] liveuser status
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-21779@lists.php.net to get a copy of this message
Hi Markus, Markus Wolff wrote:
You're right, those from the project site do contain foreign keys. And yes, there are no ON statements, because a) I think it's up to the user to decide and b) I for myself usually never use these and require the end-user to clean up his mess before he can delete anything... CASCADE can do way too much damage :-) I understand where you're coming from. A matter of personal preference really. I just like using foreign keys because I can then update/delete records etc by hand without leaving a mess behind and it saves me from writing the PHP code to do.
Sometimes other applications (other than your PHP app) also access the same data (although unlikely in LiveUser's case) and then you *do* want to data integrity to be enforced by the DB. But I can add the triggers myself if my application requires them, so no worries :-)
If you use our admin interface you don't need to worry about things like that anyways.
I guess so, but IMO it's much better to control the data integrity in the RDMBS, that's what it's for. Too bad MySql doesn't support triggers etc. Postgresql users can always add them themselves if they wish to do so.
I agree that the DBMS should handle integrity, but the admin classes contain this code anyway because we have to keep the mass of users in mind who actually use MySQL with MyISAM tables.
Yes I understand.
Just FYI, MySQL does have a limited support of triggers, meaning you can actually use ON DELETE CASCADE/SET NULL etc. if you use InnoDB tables (maybe it works with BerkeleyDB to... dunno, I don't use it). Unfortunately many people don't even know MySQL can handle foreign keys at all, or think it's too complicated, so it's not being used that often. yes I know that and I have used it. It works well. But sometimes you want other triggers (other than FKs) and you can't use those in MySql with any table handler IIRC. I for instance use them for ordered lists and trees where you have a field called say "displayorder", when you delete a record, all the other records above it should decrease their displayorder by one. Great use for a triggers. Anyways, this is a bit off-topic :-)
thanks a lot! jeroen

« previous php.pear.dev (#21779) next »