On 2017/02/08 6:45 PM, x wrote:
OK, thanks Richard. When I first discovered the function I was hoping it would
do more than it said on the tin.
Do more?
Like what?
Perhaps Richard's effort to be brief disguised the true power of the
function. If I can put it in a more descriptive manner, this function
checks (and ensures) that, within the passed text:
- All strings are complete strings,
- All comments are complete comments,
- All Quoted Identifiers are complete,
- All of the above can be contained in the statement and the statement
would enter the parser without failing on string-incompleteness,
- The statement is terminated and together with all the above
constitutes a fully parse-able SQL text string.
It seems to me that anything more you wish to check would be something
the SQL engine is better suited at checking - such as syntax, validity,
identifiers etc.
Do you know of something that can be checked more than what the
sqlite3_complete() achieves, but not high-level enough for the SQL
parser to be invoked via a prepare? Or put another way, can you think of
anything else that might make the parser say "This is an invalid sql
text and I cannot parse it" which would slip past the sqlite3_complete()
check?
If you can, it would definitely be worth the effort to add it to the
completeness check, but I would be surprised if something is found.
Examples:
sqlite3_complete("x;") -> true
sqlite3_complete(" 'x; ") -> false
sqlite3_complete(" 'x'; ") -> true
sqltie3_complete(" /* x; ") -> false
sqlite3_complete(" CREATE TRIGGER xyz blah blah; yada yada; ") -> false;
sqlite3_complete(" CREATE TRIGGER xyz blah blah; END; ") -> true;
--
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users