A limited SQL parser is fairly simple. You could write the program and launch it from a scripting language as a filter program with input and output piped.
Dennis Cote wrote: > BareFeet wrote: > >>So, before I get too far into it, I figured others of you out there >>must already have some regexes that are suitable for this, or know of >>a simpler approach. Or at worst any regex gurus out there that can >>help fine tune the above? >> > > > Regular expressions are generally not powerful enough to parse all the > variations that a language like SQL requires. If they were they would be > used by language processors such as SQLite. > > What you really need is a parser. > > SQLite uses a parser generated by the program lemon (see > http://www.hwaci.com/sw/lemon/) from the source file parse.y. You could > take this source file and modify it to suit your purposes, then build > your own parser that allows you to collect the information you need as > your SQL strings are parsed (instead of generating VDBE op-codes to > execute the queries as SQLite does). Unfortunately this may be difficult > from a scripting language. > > Some scripting languages may have libraries that allow you to build a > parser similar to lemon ( > http://search.cpan.org/~yvesp/llg-1.07/LLg.en.pod is an example from > PERL's CPAN site). > > Learning and using a parser generator can require a substantial > investment of time, but it usually results in more robust and flexible > handling of language processing tasks. > > HTH > Dennis Cote > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users