Hi Toru (and drizzle-discuss folks :))!
While sitting in sunny Spain, I've decided to play around with dumping
the token stream from a query into a SQL warning.
Surprisingly enough, it works :)
Since I didn't have a working drizzled environment on my laptop and
just a rather old 5.1.23 MySQL branch (and no network access), I used
that, but porting it to 5.1.3x should be trivial.
Next I'll try to get it working for drizzle (since doing the same for
MySQL is rather pointless) and will push a branch to Launchpad, just
in case you are interested.
I'll send a mail to you and drizzle-discuss once that's done.
I also did some digging around the item tree stuff, and it does have
one Cond_traverser visitor function that's being used for the
condition pushdown for NDB (nothing else implements it for now).
So one step is already supported in the current MySQL (not sure if
that code still lives in drizzled, though).
The only complication is: this will just give us the parts that
actually are represented by the item trees (where-, having-, ON-,
groupby-clauses etc). Actual statements have more logic to them, e.g.
joins and unions are represented by different classes which contain
each other (possibly with a "fake" structure at the top representing
the union).
Currently there's no support to dump the structure of that, although
there's support for getting the query text back (in a "normalized"
form).
I suppose we can take a good, hard stare the various print methods and
abstract something out of that, then reimplement print in terms of that.
cheers,
-k
--
Kay Roepke
Software Engineer, MySQL Enterprise Tools
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Wolf Frenkel
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028
_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help : https://help.launchpad.net/ListHelp