Thread

Posted on Thu Aug 4 23:41:14 2005 by scunacc
Calling sqlite3RunParser directly to just *parse* SQL code
Dear all, I have a "meta" application that's a bit like the sqlite shell (except it's not interactive) in which people write statements that are parsed by Perl that contain SQL statements that are passed *unparsed* by Perl to SQLite via DBD::SQLite. Some of the queries are long. To save time, users would like to be able to parse the SQL in the meta app before actually running the meta app. Clearly since this is going to run through SQLite, it'd be nice if the actual SQLite parser could parse it 1st. (I looked at SQL::Statement::Structure and wasn't happy with it - broke on things that sqlite accepts - and I didn't want to have to rewrite the grammar to append sqlite-OK items) So, having looked at the source code for the DBD driver and sqlite3, it would seem that the appropriate function to call would be sqlite3RunParser. Is there any extant code that would show this being used more or less "by itself" in an application, (i.e. w/o the heavy weight of the rest of the sqlite code scaffolding)? C code would be fine (and I'd call it as an external app 1st of all and maybe integrate later) - though I'd like to really have this as a Perl module if possible. I wanted to avoid the trial and error of figuring out which headers and what linkage and which data structures I would need to establish to minimally call this function I guess. I also couldn't see a way of (easily) extending the Perl i/face either via DBI or DBD. If I've missed anything obvious here, apart from the fact that I may just have to roll up sleeves and get to it :-) then by all means direct me to the info. Any help appreciated. Thanks! Kind regards Derek Jones.
Direct Responses: 842 | Write a response
Posted on Fri Aug 5 17:03:11 2005 by scunacc in response to 839
Re: Calling sqlite3RunParser directly to just *parse* SQL code
Dear All, I have come up with a partial solution in C - not ideal since I'd like to call this from Perl, but for the moment it'll do and it'll have to be a qx job until I have time to turn it into a Perl API call. To save on cross posting, see the following link: http://article.gmane.org/gmane.comp.db.sqlite.general/13518 (or here: http://www.mail-archive.com/sqlite-users%40sqlite.org/ and look for the subject - hadn't propagated yet to give a msgid #). Kind regards Derek Jones.
Write a response