I was experimenting with APSW and I noticed that when a query doesn't return any row, it becomes difficult to get column names from the cursor, is there any recommended way to do this ?
As you found out this happens because the cursor is immediately exhausted as there are no rows, and then is cleaned up and so column data names are not available.
Behind the scenes you can use an execution tracer to extract the information. That is what query_info does. although it aborts execution after recording it.
Thanks for the detailed explanation, I will try with apsw.ext.query_info. In my case I was building column-keyed dicts from results but as the result was an empty set, there was nothing to key on.
Appreciate the pointer to the execution tracer too.