Quite right, Paul. In that case, things wouldn't work out so well :) -jay
On Wed, Mar 3, 2010 at 10:12 AM, Paul McCullagh <[email protected]> wrote: > Hi Jay, > > This is very cool idea, and a nice improvement. > > But I guess this would not be as easy: > > use no_schema; > create table widgets; > insert into widgets (id,name) values ('a', 'apple'); > > use test; > select * from no_schema.widgets; > > On Mar 3, 2010, at 3:06 PM, Jay Pipes wrote: > >> Hi Padraig, ML, >> >> So, I was reading your excellent last couple blog entries on the new >> query rewriter interface and it dawned on me that a simple enhancement >> to the API might make working with it a little easier. >> >> In your latest post, you show a way to do SCHEMA-less queries, but you >> must prefix the query with the term "nos", like so: >> >> drizzle> nos create table widgets; >> Query OK, 0 rows affected (0.06 sec) >> >> drizzle> nos insert into widgets (id,name) values ('a', 'apple'); >> Query OK, 1 row affected (0.19 sec) >> >> drizzle> nos insert into widgets (id,name,type) values ('b', >> 'blackberry', 'phone'); >> Query OK, 1 row affected (0.21 sec) >> >> drizzle> nos select * from widgets; >> +------+------------+-------+ >> | id | name | type | >> +------+------------+-------+ >> | a | apple | NULL | >> | b | blackberry | phone | >> +------+------------+-------+ >> 2 rows in set (0 sec) >> >> I was thinking that instead of prefixing the queries with "nos" (to >> trip the rewriter into rewriting the query), it would be beneficial to >> change the plugin::QueryRewriter::rewrite() API from this: >> >> virtual void rewrite(std::string &to_rewrite)= 0; >> >> to this: >> >> virtual void rewrite(const std::string &schema_name, std::std::string >> &to_rewrite)= 0; >> >> It would be trivial to add this functionality to the API calls, as the >> Session object knows the "current" database in use and we could pass >> this schema name to the rewrite() call. Then, the user would simply >> have to do: >> >> drizzle> use no_schema; >> drizzle> select * from widgets; >> >> Then, the rewriter plugin would simply have to do a: >> >> if (schema_name.compare("no_schema") == 0) >> { >> // rewrite the supplied to_rewrite string... >> } >> >> What do people think? >> >> -jay >> >> _______________________________________________ >> Mailing list: https://launchpad.net/~drizzle-discuss >> Post to : [email protected] >> Unsubscribe : https://launchpad.net/~drizzle-discuss >> More help : https://help.launchpad.net/ListHelp > > > > -- > Paul McCullagh > PrimeBase Technologies > www.primebase.org > www.blobstreaming.org > pbxt.blogspot.com > > > > _______________________________________________ Mailing list: https://launchpad.net/~drizzle-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~drizzle-discuss More help : https://help.launchpad.net/ListHelp

