From: | Sam Mason <sam(at)samason(dot)me(dot)uk> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Wich the best way to control the logic of a web application? |
Date: | 2009-08-19 17:06:40 |
Message-ID: | 20090819170640.GV5407@samason.me.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Aug 19, 2009 at 05:46:17PM +0100, Andre Lopes wrote:
> What do you think aboout this? Should I mix logic in Database and PHP or
> should I control the logic only in the PHP?
As always, it depends! I tend to put things where ever it's most
convenient, however data integrity and other invariants within your
code will dictate some levels above which you can't place code. In
your email address example before, this can easily be done in PHP (or
even JavaScript, client side) as the database doesn't care whether it's
getting a valid email address or not--it's just a character string
to the database. To go to the other extreme, referential integrity
is (almost?) always best done inside the database as it has all the
information needed to do the right thing.
--
Sam http://samason.me.uk/
From | Date | Subject | |
---|---|---|---|
Next Message | Karsten Hilbert | 2009-08-19 17:20:10 | Re: Unit conversion database (was: multiple paramters in aggregate function) |
Previous Message | Greg Smith | 2009-08-19 16:59:23 | Re: question about /etc/init.d/postgresql in PGDG |