I'm playing with the source of MySQL (5.5) and ran into a problem. Can
you please give me a tip.
This is what I did:
let's take this statement as an example:
select * from ABDAcol2 where Hersteller = '1234';
this is what happens on the storage engine:
OK, I simplified the listing.
In cond_push() I check the statement for some special condition.
In rnd_init() I do some preparatory work, if my condition is detected,
in rnd_next() I do some work on a row and in rnd_end() I do the cleanup.
So I switched to this statement:
delete from ABDAcol2 where Hersteller = '1234';
Now it looks this way:
Now my code crashes. As you can see the order of rnd_init() and
cond_push() are swapped.
Let's take the third case:
update ABDAcol2 set hersteller = '12' where Hersteller = '1234';
The calls are like this:
Again rnd_init() comes before cond_push().
If the calls happen in this order my initialization is not done because
the situation is not detected yet. Later the situation is detected but
no initialization follows.
So what's wrong here?
Was I wrong with my assumption of the order in wich the functions are
called? In the csv-engine the order of the function-calls is described
as in my example above with the select-stmt.
Or: do I have to do my initializations in the cond_push()-function? Or
in the rnd_next()-function when it's called for the first time?