Is there a way to check the syntax of a SQLite3 script without running it?
Basically, I'm looking for the SQLite3 equivalent of ruby -c script.rb
, perl -c script.pl
, php --syntax-check script.php
, etc.
I've thought of using explain
, but most of the scripts I'd like to check are kept around for reference purposes (and don't necessarily have an associated database). Using explain
would also make it hard to use with something like Syntastic. (That is, I'm only wanting to check syntax, not semantics.)
Update:
I'm confused. Let's say I want to syntax check this:
select * from foo;
I could do something like:
echo 'explain select * from foo;' | sqlite3
But then I get:
SQL error near line 1: no such table: foo
All I'd expect to see is "Syntax OK" (or something similar). Is that possible?