I think it would be a good idea to deprecate cascading update & delete from Zend_Db, but I suppose too many people rely on it now.

Perhaps it can be a goal of Zend Framework 2.0.

Regards,
Bill Karwin

On Mar 29, 2010, at 10:11 AM, 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...

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.

Best regards
--
Guillaume

Le 29/03/10 18:51, Bill Karwin a écrit :
Thanks Jared, that's good to know.  It appears that version of SQLite
only came out in October 2009. Kudos to the contributors of SQLite who
made that feature possible! And thanks for pointing it out.

There's virtually no reason to avoid using RI constraints now.

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.

Regards,
Bill Karwin

On Mar 29, 2010, at 9:21 AM, Jared Williams wrote:


Sqlite 3.6.19 and later have RI,
http://www.sqlite.org/foreignkeys.html .

Jared

-----Original Message-----
From: Bill Karwin [mailto:[email protected]]
Sent: 29 March 2010 17:03
To: [email protected]
Subject: Re: [fw-general] recurse on cascade delete

I regret implementing the cascading delete in Zend_Db_Table
even for one level. It was hard to do, required a lot of
code, and still doesn't work. Even fixing ZF-1103 won't be
enough. It's not possible to ensure data consistency when
cascading operations are implemented in PHP code.

You should implement cascading delete or cascading update by
defining
SQL constraints in your database. I know there are a couple of
technologies that don't support RI constraints (MyISAM,
SQLite). If you need cascading delete or update, you should
define triggers in the database, or else change to some other
storage engine.

Regards,
Bill Karwin

On Mar 29, 2010, at 3:54 AM, Guillaume ORIOL wrote:

Hi,

I was working on an application that uses cascade delete and
discovered a bug that was already known and reported.

I was wondering why the corresponding issue
http://zendframework.com/issues/browse/ZF-1103
had not been closed and included in a previous ZF release,
as a patch
was provided and no new activity was recorded on the ticket since
january the 2nd.

The lack of a consistent ON DELETE mechanism is rather awkward.

Best regards
--
Guillaume ORIOL
Software engineer
Technema

Reply via email to