SQL::Tokenizer and Tao::DBI

izut on 2007-02-13T09:23:18

I've been working last week on SQL::Tokenizer, which was used to, erm, tokenize a SQL query correctly to extract named placeholders for a DBI subclass I'm working on. It is actually using the known-and-loved Perl's regular expression engine, but maybe I can write a version using Pugs::Compiler::Rule, let's see.

About the DBI subclass I mentioned above, Adriano wrote the Tao::DBI, which is a proxy to DBI that implements the named placeholders concept. I liked that and re-implemented the Tao::DBI as a subclass of DBI, but since it is not backward compatible with Adriano's one, I have to found another name for it before release.

Any suggestion?


Thanks for SQL::Tokenizer

renodino on 2007-02-13T18:57:28

I've been thinking of doing something similar for some SQL::Statement subclasses I've been working on, but you beat me to it. (S::S just does progressive regexes, which makes for some very muddy code at times). Should be very helpful in getting those subclasses done.

BTW: I noted you only support ANSI comments; have you considered support for C style "/* ... */" comments ? (many databases support the latter).

Also wrt named placeholders, I don't know if its possible, but it might be nifty to directly reference Perl variables. I've done that with SQL::Preproc, but it uses a source filter, which scares most people off.

Re:Thanks for SQL::Tokenizer

izut on 2007-02-14T13:50:15

I thank you for using my code :-) I'll implement the C style comments, following your suggestion.

I'll see if the direct references to Perl variables when using named placeholders is a Good Thing(tm).

I'm planning to release the code-that-was-named Tao::DBI when I find a new name for that. Some friends of mine suggested DBIx::WithPlaceholder, but I'm planning to ask about it at Perlmonks.