[nycphp-talk] MySQL, MyISAM tables, <trigger> | <on delete cascade> - Help
Phil Powell
phillip.powell at adnet-sys.com
Fri Feb 20 10:33:31 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.
>
>
>
I know I can't use foreign key constraints; my tables are MyISAM tables.
I was hoping for a back-end script (in TCL which I know natively)
that would mimic the behavior of a cascade function, that way it is not
being done in the middle-tier and perhaps might be a performance-saving
option.
Phil
>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
>
>
>
--
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