I have one question:
I am programming with PHP, CodeIgniter. But it may suit for other tools as well. I need to delete something from the table and I want to be sure that there will be deleted row from another table. In short - delete to rows, each from different table.
One way is to use transaction. With CodeIgniter I can to this:
$this->db->trans_start(); delete row from table A delete row from table B $this->db->trans_complete();
Another way is to create a stored procedure which deletes these to rows and call it from PHP.
I guess the achieved result is the same. So which way is better? Or is there some differences?
Edit: I saw one difference
DELIMITER $$ -- -- Procedūros -- CREATE DEFINER=`ylakiai_darzelis`@`localhost` PROCEDURE `del_info_page`(IN eil INT) BEGIN DELETE FROM info_psl WHERE eil_nr = eil; DELETE FROM virsutinis_meniu WHERE eile = eil; UPDATE virsutinis_meniu SET eile = eile - 1 WHERE eile > eil; UPDATE info_psl SET eil_nr = eil_nr - 1 WHERE eil_nr > eil; END$$ DELIMITER ;
This code is phpMyAdmin export.
I need to remove this
to work on my computer. Its not that comfortable.
Edited by McLaren: n/a