On Wednesday, 4 September, 2019 12:18, Rob Sciuk <r...@controlq.com> wrote:

>Forgive me if this is an FAQ, but in looking over the python3 interface to
>SQLITE3, I cannot see a way to get the result code (SQLITE_OK) after an
>execute() command.

>My use case is to differentiate between an empty row set (OK) vs an error
>of some kind in the query.

>Anyone figured this out?

If there is an error then an exception will be thrown.  No exception means no 
error.  Otherwise, iterating over the cursor will return the rows.  If there 
are no rows then it is like iterating over an empty list -- there is nothing to 
return (the cursor object is a generator that yields row tuples and it will 
internally raise StopIteration when it is out of data to return, just like any 
other generator).

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to