[nycphp-talk] MySQL, MyISAM tables, <trigger> | <on delete cascade> - Help
Phil Powell
phillip.powell at adnet-sys.com
Fri Feb 20 12:32:22 EST 2004
David Mintz wrote:
>MyIsam doesn't support foreign key constraints but InnoDB does. If you use
>InnoDB tables you can have cascading deletes.
>
>Alternatively, tho you said you want to avoid it, you can do it yourself
>in the middle tier (PHP) -- it ain't that hard.
>
>See, e.g., "MySQL" by Paul DuBois, 2nd edition.
>
>
>
>On Fri, 20 Feb 2004, Phil Powell wrote:
>
>
>>I am having to create a cascade delete effect on table "department" that
>>is configured in the following fashion:
>>
>>I am having to delete a department; if I do so, I would naturally have
>>to delete all child records associated with the department.
>>Best approach would be to do a "cascade delete" variation (deleting all
>>child records first and then parent row), however, only
>>MaxDB seems to support that (see
>>http://www.mysql.com/documentation/maxdb/94/c38409c20611d5993d00508b6b8b11/content.htm
>>and
>>http://www.mysql.com/doc/en/InnoDB_foreign_key_constraints.html ),
>>however, that seems to be not possible since my tables are MyISAM
>>by default. Therefore, I am offered the possibility of a trigger.
>>However, the beforementioned article indicates triggers
>>aren't supported in MySQL.
>>
>>What would then be your best recommendation, based upon the need and the
>>schema, for me to ensure that all related records are
>>deleted? I would prefer not to have to write a PHP script to have to do
>>so, but is that all I'm stuck with?
>>
>>
>
>
>---
>David Mintz
>http://davidmintz.org/
>
> "Anybody else got a problem with Webistics?" -- Sopranos 24:17
>_______________________________________________
>talk mailing list
>talk at lists.nyphp.org
>http://lists.nyphp.org/mailman/listinfo/talk
>
>
>
for now, using more "open source" tools, I built a TCL script to perform
the recursive cascading action upon the table by doing an exec on a
shell script I wrote to do command-line mysql commands.
Phil
--
Phil Powell
Web Developer
ADNET Systems, Inc.
11260 Roger Bacon Drive, Suite 403
Reston, VA 20190-5203
Phone: (703) 709-7218 x107 Cell: (571) 437-4430 FAX: (703) 709-7219
EMail: Phillip.Powell at adnet-sys.com AOL IM: SOA Dude
More information about the talk
mailing list