[plt-scheme] Re: SQLite error

From: Thomas Chust (chust at web.de)
Date: Wed Jul 22 03:25:30 EDT 2009

2009/7/22 Jay McCarthy <jay.mccarthy at gmail.com>:
> [...]
> I don't parse SQL at all, but let it do it for me. This message comes
> from the parser that returns an error if it does not parse one SQL
> statement. Unfortunately, zero AND two or more statements are both not
> one statement, and I can't tell the difference based on its error
> codes.
> [...]


I'm not sure whether it would really be worth the effort, but you
should in principle be able to tell the difference by using the pzTail
output parameter of the SQLite API function that compiles the
statement: If the tail pointer passed out is identical to the SQL
source pointer passed in, nothing has been compiled, if it's
different, at least one statement has been consumed by the parser.

Probably it is not completely trivial to implement that logic, though,
because the SQL source pointer passed to the SQLite API call is not
directly visible to Scheme code but rather some buffer allocated by
the FFI.


When C++ is your hammer, every problem looks like your thumb.

Posted on the users mailing list.