[Interest] Qt Sql BLOB data converting
scott at towel42.com
Mon Nov 28 21:39:05 CET 2022
From: Interest <interest-bounces at qt-project.org> On Behalf Of Thiago Macieira
Sent: Monday, November 28, 2022 12:21 PM
To: interest at qt-project.org
Subject: Re: [Interest] Qt Sql BLOB data converting
On Monday, 28 November 2022 12:07:22 PST Scott Bloom wrote:
> but if they did a create XXX as string, insert XXX=123 (integer) and
> Sqlite can return it as a string or an integer, the QVariant should be
> created from an string not an integer. The same goes if they did a
> create XXX as integer, insert XXX='123'. QVariant should be created
> as from an integer type, and they can do a toString on the variant if they want.
> My point, dynamic types should follow C++ style "dynamic" typing not
> "everything is a string until proven otherwise" typing of other languages.
I don't agree. Sqlite seems to have made a choice that the type is stored per row, but gives you the ability to choose otherwise either at table creation time or at selection time. Changing the behaviour right now would remove that possibility.
I don't know if it is surprising or not for unwary people.
But I can tell you that no action will happen because QtSql is right now under-maintained and there are no volunteers to understand all the implications of such a choice.
I understand the "understaffed" issue, however, to me its problematic that the record method returns a different type than the row. It s been this way for sometime. In fact, I brought this up with the Sql team back in the Qt 4 days.
Strict tables were only added in Sqlite 3.37, I don't know what version of sqlite3 is used in Qt6, my version of Qt5.15.6 doesn't support it.
This issue, of a blob interpreted as a string has existed for ages.
I just think it's a mistake to determine the type of a column in two different ways.
More information about the Interest