I am having a bit of a problem fixing the following bug:
The problem is that it leads to "nested statements".
In the test, we have a table called tb0_eng2 which contains a few rows:
create table tb0_eng2 (
i1 int NOT NULL auto_increment, primary key (i1),
f2 char (32)
insert into tb0_eng2 (f1,f2) values
One of the rows is being constantly updated, as follows:
update tb0_eng2 set f2='Update #$counter' where f1=10;
A trigger on tb0_eng2, does an INSERT on tb0_logs for every UPDATE on
Create trigger tb0_eng2_upd after update on tb0_eng2
for each row
insert into tb0_logs (entry_dsc)
values (concat('Update row ', old.i1, ' ', old.f2, ' -> ',
So the INSERT statement is "nested" in the UPDATE statement.
My problem is that I need to detect the start and end of statements.
As far as I can tell (at least I have always assumed this) in this case:
ha_handler::start_stmt() is called for each table at the start of a
ha_handler::reset() is called for each table at the end of each
It would be easy to tell the start and end of statements if these
functions were only called ONCE for each statement.
However, if multiple tables are involved in a statement (which is not
the case in the example above), then start_stmt() and reset() are
called multiple times for each statement.
So how do I know where the actual boundaries of the statements are?
Any help would be appreciated.