Re: Wich the best way to control the logic of a web application? - Mailing list pgsql-general

From Sam Mason
Subject Re: Wich the best way to control the logic of a web application?
Date
Msg-id 20090819170640.GV5407@samason.me.uk
Whole thread Raw
In response to Wich the best way to control the logic of a web application?  (Andre Lopes <lopes80andre@gmail.com>)
List 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/

pgsql-general by date:

Previous
From: Greg Smith
Date:
Subject: Re: question about /etc/init.d/postgresql in PGDG
Next
From: "Karsten Hilbert"
Date:
Subject: Re: Unit conversion database (was: multiple paramters in aggregate function)