[Interest] Qt Sql BLOB data converting

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Mon Nov 28 20:53:59 CET 2022

Am 28.11.2022 um 20:31 schrieb Scott Bloom:
> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Thiago Macieira
> Sent: Monday, November 28, 2022 11:21 AM
> To: interest at qt-project.org
> Subject: Re: [Interest] Qt Sql BLOB data converting
> On Monday, 28 November 2022 10:59:47 PST Christian Ehrlicher wrote:
>> It's because of the dynamic typing feature of sqlite (
>> https://www.sqlite.org/flextypegood.html ) - even a column is created
>> as one type it can contain another one. Looks like the data was
>> inserted with the wrong type information since your blob data is for
>> sure no readable string.
> Thanks for the explanation, Christian. I can confirm that the type comes out correctly if it is inserted into the table AS blob, not as plaintext.
> Therefore, the problem is on the insertion side, not  in the SELECT or QtSql.
> I've closed the task.
> --
> I disagree with closing it.
> When the cache is being created, it should use the same method for determining the type of a column as the record function does.
> First check the name of the column type, then use the enumerated type if the string name is empty.

This will not work when you fetch two rows with different dynamic types
for a column - there is only one record per result set. But at least we
should be consistent by directly using the already calculated values
from the record instead calling sqlite3_column_type() again.


More information about the Interest mailing list