Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apsw shell doesn't understand commented out queries #212

Open
phdru opened this issue Mar 28, 2016 · 4 comments
Open

apsw shell doesn't understand commented out queries #212

phdru opened this issue Mar 28, 2016 · 4 comments

Comments

@phdru
Copy link

phdru commented Mar 28, 2016

$ apsw database.sqlite 
SQLite version 3.8.7.1 (APSW 3.8.6-r1)
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT * FROM sqlite_master;
…output…
sqlite> -- SELECT * FROM sqlite_master;
    ..> ;
sqlite> 

Ouch!

This is important because I have commented out queries in .sqliterc and apsw shell has problems reading them.

@rogerbinns
Copy link
Owner

This is because I use sqlite3_complete to tell if there is complete input and it says no when there is a comment. The sqlite shell doesn't have the same problem so I need to investigate what they do differently.

@rogerbinns
Copy link
Owner

The SQLite shell does it's own parsing which is how it avoids this problem.

@phdru
Copy link
Author

phdru commented Mar 27, 2023

The SQLite shell does it's own parsing which is how it avoids this problem.

I see. Thanks!

@rogerbinns
Copy link
Owner

Forum post asking for SQLite changes: https://sqlite.org/forum/forumpost/666f572d3c

I can't think of another way around this, short of writing a SQL parser to figure it out just like the shell did. A pure comment statement can be detected by sqlite3_prepare returning NULL, but it is easy to get outfoxed eg with SELECT 3; /* unterminated comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants