This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author erlendaasland
Recipients berker.peksag, erlendaasland, serhiy.storchaka
Date 2021-02-18.11:14:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1613646863.88.0.107963073708.issue43249@roundup.psfhosted.org>
In-reply-to
Content
sqlite3_column_bytes() should be called _after_ sqlite3_column_blob(). There two calls to sqlite3_column_blob() are both preceeded by calls to sqlite3_column_bytes(). Currently it does not do any harm, but it is bad API usage.

I suggest to fix the two cases, and add a comment in the source code as a reminder.

Berker?


Quoting from https://sqlite.org/c3ref/column_blob.html:
The safest policy is to invoke these routines in one of the following ways:
  * sqlite3_column_text() followed by sqlite3_column_bytes()
  * sqlite3_column_blob() followed by sqlite3_column_bytes()
  * sqlite3_column_text16() followed by sqlite3_column_bytes16()

In other words, you should call sqlite3_column_text(), sqlite3_column_blob(), or sqlite3_column_text16() first to force the result into the desired format, then invoke sqlite3_column_bytes() or sqlite3_column_bytes16() to find the size of the result.
History
Date User Action Args
2021-02-18 11:14:23erlendaaslandsetrecipients: + erlendaasland, berker.peksag, serhiy.storchaka
2021-02-18 11:14:23erlendaaslandsetmessageid: <1613646863.88.0.107963073708.issue43249@roundup.psfhosted.org>
2021-02-18 11:14:23erlendaaslandlinkissue43249 messages
2021-02-18 11:14:23erlendaaslandcreate