SQLite Forum

[SQLite WASM] pragma table_info
Login

[SQLite WASM] pragma table_info

(1) By mmomtchev on 2023-03-24 16:04:56 [source]

PRAGMA TABLE_INFO("table");

seem to return an empty result set - both using the Promiser and the OO1 synchronous API. I guess that it has something to do with the fact that this is not SQL data. Is there any way around this?

(2) By Stephan Beal (stephan) on 2023-03-24 16:21:52 in reply to 1 [link] [source]

PRAGMA TABLE_INFO("table");

i don't know for sure that this will help, but make sure to use single quotes, not double quotes. The deprecated double-quoted strings support is disabled in the WASM build.

There is nothing magical about that pragma which should cause it to behave any differently in JS but i will try it out later this evening.

(3) By mmomtchev on 2023-03-24 17:13:52 in reply to 2 [link] [source]

In fact the empty result set is the expected response when the table does not exist.

In the CLI, whether I use table, 'table' or "table" - it works. I haven't found a combination that works in SQLite WASM.

(4) By Stephan Beal (stephan) on 2023-03-24 17:20:55 in reply to 3 [link] [source]

In the CLI, whether I use table, 'table' or "table" - it works. I haven't found a combination that works in SQLite WASM.

Checkin src:98d30400e4721b1d was just added to check that this pragma works like it should and it seems to. Both 'table' and "table" forms worked fine for me in testing.

If you like, feel free to contact me off-list and we can try to narrow down the problem.

(5) By mmomtchev on 2023-03-24 18:43:41 in reply to 4 [link] [source]

Well, it is completely my fault - ie the HTTP VFS driver, I am sorry.

I brute-forced it by returning the same values as the OPFS driver - and I found that not returning an error for a xFileControl call that is not SQLITE_FCNTL_SYNC was the cause. SQLite will call it with a SQLITE_FCNTL_PRAGMA - and I have to return an error in this case.