jssmith / ssqlite

Serverless SQLite Experiments
6 stars 3 forks source link

Shell error after creating database #10

Closed jssmith closed 6 years ago

jssmith commented 6 years ago

After opening a database some of the basic shell commands are broken, e.g.:

SQLite version 3.21.0 2017-10-24 18:55:49
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .load ./nfs4
sqlite> .open 192.168.1.57/mytestdb
sqlite> .tables
Error: near "ORDER": syntax error
sqlite>
convolvatron commented 6 years ago

this one is really strange. with tracing turned on it just does a single status request with SQLITE_FCNTL_POWERSAFE_OVERWRITE which is supposed to be a set, and we should return SQLITE_OK. then the parser throws a syntax error.

jssmith commented 6 years ago

I tried looking at it a little bit earlier… assuming that the wrong SQL is getting built somehow.

convolvatron commented 6 years ago

oh, this turned out to be pretty straightforward, as the result of kind of a dumb vfs thing.

there is an open-ended fcntl called pragma. if you return SQLITE_OK, it assumes you did the work. in this case its allowing the vfs to provide the database list....not sure exactly why, so if you dont return SQLITE_NOTFOUND, it assumes there are no databases. fixed in gperf