Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Thiago Macieira
On Monday, 28 November 2022 14:29:30 PST Scott Bloom wrote: > While this might be the expectation from the Qt side of the world 😊 On > windows, I don’t know of anyone who does this. Not so uncommon on linux, > but "all" 3rd party? I wouldn’t say that happens often That's not even the expectation

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
-Original Message- From: Interest On Behalf Of Thiago Macieira Sent: Monday, November 28, 2022 1:41 PM To: interest@qt-project.org Subject: Re: [Interest] Qt Sql BLOB data converting On Monday, 28 November 2022 12:39:05 PST Scott Bloom wrote: > Strict tables were only added in Sqlite 3.

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Thiago Macieira
On Monday, 28 November 2022 12:39:05 PST Scott Bloom wrote: > 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. Hence the rule of thumb: ALWAYS unbundle the third party content and build the necessary li

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
-Original Message- From: Interest On Behalf Of Thiago Macieira Sent: Monday, November 28, 2022 12:21 PM To: interest@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,

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Thiago Macieira
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,

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
-Original Message- From: Interest On Behalf Of Christian Ehrlicher Sent: Monday, November 28, 2022 11:54 AM To: interest@qt-project.org Subject: Re: [Interest] Qt Sql BLOB data converting Am 28.11.2022 um 20:31 schrieb Scott Bloom: > -Original Message- > From: Interest On Be

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Christian Ehrlicher
Am 28.11.2022 um 20:31 schrieb Scott Bloom: -Original Message- From: Interest On Behalf Of Thiago Macieira Sent: Monday, November 28, 2022 11:21 AM To: interest@qt-project.org Subject: Re: [Interest] Qt Sql BLOB data converting On Monday, 28 November 2022 10:59:47 PST Christian Ehrlic

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
-Original Message- From: Interest On Behalf Of Thiago Macieira Sent: Monday, November 28, 2022 11:21 AM To: interest@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

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
Just a POINT of note. Since SQL Lite has moved to “flexible typing” (its been a while) they have also added a strict datatype table Which I have been using myself. For this case, rather than CREATE TABLE IF NOT EXISTS "test" ( "value" BLOB NOT NULL ); You would use CREATE TABLE IF NO

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Thiago Macieira
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 infor

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Scott, thanks you for your time On Mon, Nov 28, 2022 at 10:11 PM Scott Bloom wrote: > @Christian Ehrlicher you beat me to the punch. > > If you dump out the value (not the size) you will see the QVariant is a of > type QString not QByteArray > > const auto value = query.value(0); >

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Scott Bloom
@Christian Ehrlicher you beat me to the punch. If you dump out the value (not the size) you will see the QVariant is a of type QString not QByteArray const auto value = query.value(0); qDebug() << "value = " << value; auto tmp = QVariant( value.toByteArray() ); qD

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Christian, thanks a lot it is work now, fine On Mon, Nov 28, 2022 at 10:01 PM Christian Ehrlicher wrote: > > Am 28.11.2022 um 19:46 schrieb Yauheni Pervenenka: > > Christian, thanks for your effort, db was simplified for test, is it > > possible to fix it on the client side? Any ideas, why is co

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Christian Ehrlicher
Am 28.11.2022 um 19:46 schrieb Yauheni Pervenenka: Christian, thanks for your effort, db was simplified for test, is it possible to fix it on the client side? Any ideas, why is column considered as SQLITE_TEXT if it is BLOB? It's because of the dynamic typing feature of sqlite ( https://www.s

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
I used sqlite3 python module, and it is parsed fine On Mon, Nov 28, 2022 at 9:46 PM Yauheni Pervenenka < yauheni.pervene...@viber.com> wrote: > Christian, thanks for your effort, db was simplified for test, is it > possible to fix it on the client side? Any ideas, why is column considered > as SQ

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Christian, thanks for your effort, db was simplified for test, is it possible to fix it on the client side? Any ideas, why is column considered as SQLITE_TEXT if it is BLOB? On Mon, Nov 28, 2022 at 9:40 PM Christian Ehrlicher wrote: > > Am 28.11.2022 um 19:16 schrieb Yauheni Pervenenka via Inter

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Christian Ehrlicher
Am 28.11.2022 um 19:40 schrieb Christian Ehrlicher: Am 28.11.2022 um 19:16 schrieb Yauheni Pervenenka via Interest: Thiago, hello, thanks for your reply, sorry have no instructions for create and insert, but have data base with one value which can't be parsed correct(db is cut to one value for

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Christian Ehrlicher
Am 28.11.2022 um 19:16 schrieb Yauheni Pervenenka via Interest: Thiago, hello, thanks for your reply, sorry have no instructions for create and insert, but have data base with one value which can't be parsed correct(db is cut to one value for provide example) https://bugreports.qt.io/browse/QTB

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Thiago, hello, thanks for your reply, sorry have no instructions for create and insert, but have data base with one value which can't be parsed correct(db is cut to one value for provide example) https://bugreports.qt.io/browse/QTBUG-108992 On Mon, Nov 28, 2022 at 9:07 PM Thiago Macieira wrote:

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Thiago Macieira
On Monday, 28 November 2022 01:00:01 PST Yauheni Pervenenka via Interest wrote: > QSqlQuery query("SELECT value from table"); > while (query.next()) { > const auto value = query.value(0); > qDebug() << value.toByteArray().size(); // size 52 > qDebug() << value.toString().size(); // size 30 > qDebu

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Hello, Henry, thanks for the reply, seems like no, there is simple code QSqlQuery query("SELECT value from table"); while (query.next()) { const auto value = query.value(0); qDebug() << value.toByteArray().size(); // size 52 qDebug() << value.toString().size(); // size 30 qDebug() << value.toByteA

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Henry Skoglund
On 2022-11-28 09:32, Yauheni Pervenenka via Interest wrote: Hi, Tony, thanks for your reply, OS: win 11 DB: SQLite Unfortunately, QVariant::toByteArray returns size 52(hex 104), QVariant::toString returns size 30 There is data returned by QVariant::toByteArray::toHex Qt data in hex(size 104):

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Yauheni Pervenenka via Interest
Hi, Tony, thanks for your reply, OS: win 11 DB: SQLite Unfortunately, QVariant::toByteArray returns size 52(hex 104), QVariant::toString returns size 30 There is data returned by QVariant::toByteArray::toHex Qt data in hex(size 104): 763130492d46c2ab4cc29c7bc2b0efbfbd78c29b29c3ab1e4723dea6efbfbde

Re: [Interest] Qt Sql BLOB data converting

2022-11-28 Thread Tony Rietwyk
Hi Yauheni, You don't say which type of database you are using?  There may be issues with the database client library altering the blob to UTF8.  Though I would expect the python code using the same client to have the same problem. Assuming that QVariant has the byte array unaltered, then Q