Re: re:database tables relations advice
| From: | Bastien Koert | Date: | Mon, 01 Dec 2008 01:39:25 +0000 |
| Subject: | Re: re:database tables relations advice | ||
| References: | 1 2 3 4 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-45756@lists.php.net to get a copy of this message | ||
On Fri, Nov 28, 2008 at 5:52 PM, Fergus Gibson <fgibson75@gmail.com> wrote:
> On Thu, Nov 27, 2008 at 11:19 AM, Bastien Koert <phpster@gmail.com> wrote:
> > 2. It is possible to use the application to handle the keys instead of
> the
> > database, it involves more work around key checking / validation before
> > creating or updating records, but it can be done if the INNODB table type
> is
> > not accessible to you for some reason.
>
> Yes, but generally foreign key constraints are preferable. The
> database server is compiled in native code, so it'll be much faster at
> handling this issue; and it may avoid the necessity of your script
> submitting multiple queries to resolve the foreign key issues. A
> bigger issue though is that the implementation of foreign key
> constraints on the server will have been exhaustively tested.
> Reinventing the wheel in your own PHP code may introduce bugs that
> cause loss or damage to your data.
>
Correct, I was merely offering an alternative if the INNODB / FK constraints
are not available. I have to do that with ASP code that I maintain, but its
a real bitch to manage
--
Bastien
Cat, the other other white meat