> -----Original Message----- > From: Ralph Schindler [mailto:[email protected]] > Sent: 30 March 2010 06:00 > To: Guillaume ORIOL > Cc: [email protected] > Subject: Re: [fw-general] recurse on cascade delete > > > > Guillaume ORIOL wrote: > > Thank you for your advice. > > > > I am using MySQL 5 with InnoDB engine which implements > cascade deletes > > as well as triggers. > > I have to confess I am not very comfortable with triggers. And the
> > logic behind the cascade delete is fairly complex in my > application. > > Therefore I tried to implement it with php code and ZF. > Now, I know I > > have to learn more about triggers... > > This is the best place to put database specific business > rules, especially if you don't see yourself needing database > platform independent code. One of the things to keep in mind > when you start implementing your business logic in the > database itself is that now you'll have two codebases you > need to also maintain.. the application code, and also the > database code. > > That brings me to the point below... > > > But let me ask one question: as a full implementation is > not possible > > (or at least very complex), why not to remove it completely from > > Zend_Db? I find it inconsistent as it is. > > > > ... see below ... > > >> > >> The reasons to use MyISAM are dwindling. It used to be faster than > >> InnoDB, but this is less and less true now that the performance of > >> the InnoDB plugin storage engine has improved so much. If > you want to > >> use the FULLTEXT index which only supports MyISAM, other > options like > >> Solr and Sphinx are available and probably better. > > While I whole-heartedly agree, MyISAM still has critical mass > when it comes to marriage of Mysql+PHP. In fact, some people > STILL use the mysql_ set of functions. > > That said, even though database platforms are catching up > when it comes to features that enhance the ability to write > business specific rules, we still have a very popular lowest > common denominator. And if database platform independent > code is a goal of yours, then relying on FK constraints and > triggers might not be an option. > > In this case, I think this feature-set is pretty important. > This is why I supplied a patch that I had hoped more people > would have looked at. > If it meets community standards, I'd be OK with this going > into ZF. In the mean time, you are free to apply this patch > and/or extends Zend_Db to fulfill this need. > I don't think it is possible to implement a robust cascading delete in an application without transaction support. (eg MyISAM) You need a transaction to ensure either all the delete statements run, or none of them. Jared
