[ Sorry - previous emal had the wrong pragma in two places (but the right one 
in the code sample so I don't feel quite so dumb.  It seems from the sqlite 
docs that I should be getting different results than I am:

PRAGMA empty_result_callbacks;
PRAGMA empty_result_callbacks = 0 | 1;

Query or change the empty-result-callbacks flag.

The empty-result-callbacks flag affects the sqlite3_exec API only. Normally, 
when the empty-result-callbacks flag is cleared, the callback function 
supplied to the sqlite3_exec() call is not invoked for commands that return 
zero rows of data. When empty-result-callbacks is set in this situation, the 
callback function is invoked exactly once, with the third parameter set to 0 
(NULL). This is to enable programs that use the sqlite3_exec() API to 
retrieve column-names even when a query returns no data. ]

I'm using APSW 3.0.8-r3 on Python Windows XP Pro with Python 2.3.4.

Minimal test-case code:

import apsw
db = apsw.Connection('test.db3')
cursor=db.cursor()
cursor.execute('PRAGMA empty_result_callbacks = 1')
sql="select * from testnn" # testnn is empty
cursor.execute (sql)
description = cursor.getdescription()

Results:

Traceback (most recent call last):
 File "test_pragma.py", line 7, in ?
  description = cursor.getdescription()
apsw.ExecutionCompleteError: Can't get description for statements that 
have completed execution

Am I doing something wrong here? ÂI'm expecting a description even 
though the table is empty because the empty_result_callbacks pragma is on.

TIA,
Scott

Reply via email to