automatism to delete related records

A place for users and developers of the Xataface to discuss and receive support.

automatism to delete related records

Postby kurisusan » Sun Feb 10, 2008 5:24 am

Hello,

is there any automatism to delete related records after having deleted a 'parent' record?

Christian
kurisusan
 
Posts: 25
Joined: Sat Oct 27, 2007 2:40 am

Postby shannah » Sun Feb 10, 2008 9:23 am

Best way is to use the INNODB storage engine for those tables, and then use a foreign key relationship with "on delete cascade".

That way the database will always stay consistent.

The alternative is to use an afterDelete() trigger in the parent record to delete the child.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby kurisusan » Sun Feb 10, 2008 10:31 am

Thanks. I cannot change the db enginge, though.
As Record->delete() is not implemented, how do I delete a record? Using plain sql?

Christian
kurisusan
 
Posts: 25
Joined: Sat Oct 27, 2007 2:40 am

Postby shannah » Sun Feb 10, 2008 6:03 pm

Yes. Best just to do mysql_query()
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 16 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved