G'day! As some of you already know, lately I've been experimenting on making the current parser pluggable. I've managed to write a demo that passes the test suite so I wanted to get some feedbacks on what you all think.
The tree is at: http://bazaar.launchpad.net/~tmaesaka/drizzle/pluggable-parser So, what I've done in this tree is simple. I replaced the current entry point of the parser (mysql_parse) with a plugin entry point and pushed out what was behind mysql_parse() into a mandatory module. The idea is that a module implements a parser that populates the session object using the provided query string, query length and a variable for the discovered semicolon with this interface: bool (*sql_parse)(Session *session, const char *query, const size_t query_len, const char **found_semicolon); Saying that, things weren't as simple as I wanted it to be and I had to do the following to modularize the parser: - Separate mysql_execute_command() from the parser for a "clean" separation of the parser from the core. I've added a wrapper function within the core called sql_parse_and_execute() to replace where previously parsing and query execution occurred at the same place. Also, although my original intention was to only introduce one plugin function, I had to unfortunately add another one called: sql_parse_vcol_expr(Session *session, const char *vcol_expr, const size_t length); this is due to the way unpack_vcol_info_from_frm() in table.cc relies on a direct call to the parser to translate the virtual column expression from a .frm file into an Item object. So, I needed a way to directly call the raw parser without going through housekeeping. I reaaaaaally don't want this function but to kill this thing, we need to come up with a way to create a virtual column object without relying on the parser. Either that or I think we can kill this function when Drizzle doesn't need .frm files anymore. I think this is currently being worked on? Anyhow, that's all I have to say for now! It would be great if you guys could tell me whether I screwed up miserably or if its worth considering :) -- Toru Maesaka <[email protected]> _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

