Tony Marston wrote:

> You do not need stored procedures or database triggers to write successful
> applications. I once had to maintain a system that was built around
> procedures and triggers, and it was a nightmare. The problem was that one
> trigger/procedure updated several tables, which fired more triggers which
> contained more updates which fired more triggers ..... It was impossible to
> keep track of what was being fired where.

Design of complex systems is, necessarily, complex. One approach is to 
consolidate all of the logic at one layer -- but that can result in 
significant performance differences for an app that uses stored 
procedures / triggers / functions to avoid communications overhead of 
the client-server interactions and to take advantage of the built-in 
optimizations the SQL engine can use for stored procedures / functions.

> Another reason I prefer to put all my business logic into PHP code instead
> of triggers is that PHP code is a lot easier to debug. Have you come across
> an interactive debugger for database procedures and triggers?

Not quite on topic, because it's not an open source database, but DB2 
does includes an interactive debugger for stored procedures in the DB2 
Development Center 
(http://publib.boulder.ibm.com/infocenter/db2help/topic/com.ibm.db2.udb.doc/ad/t0007399.htm)

In some cases I would argue that issuing a couple of CALL and SELECT 
statements is a lot easier than trying to figure out whether you've 
introduced a problem in your PHP code or in your SQL statements within 
the PHP code.

Dan