[Interest] SQLite: mystic bug: No query Unable to fetch row error

Alexander Dyagilev alervdvcw at gmail.com
Fri Jan 15 07:31:19 CET 2021


Hello,

BLOB, so any arbitrary data is allowed. Thus the reason is not that the 
first byte is 0.


On 1/15/2021 2:55 AM, Tony Rietwyk wrote:
> Hi,
>
> I haven't used SQLite, but I'm wondering if when the UuidByteArray 
> starts with a zero byte, then maybe nothing gets written for the 
> value?  1 in 16 of the generated UUID's could have this, which roughly 
> matches your 4% failures.
>
> Is a BLOB field binary or text?  Does a binary blob with embedded 
> zeroes always get fully written?  Maybe using base64 encoding would 
> work better?
>
> Hope that helps,
>
>
> On 15/01/2021 2:18 am, Alexander Dyagilev wrote:
>> Hello,
>>
>> Each instance of our app is supposed to have an unique id (UUID).
>>
>> At every start, it check if it has assigned one, and if not - 
>> generates it and saves it to the SQLite database.
>>
>> We've found, that 4% of ours users has empty UUIDs.
>>
>> We've added some diagnostic reporting info and found, that this is 
>> caused by SQLite database not being able to write generated UUID to it.
>>
>> QSqlQuery::exec returns false and its last error returns this error 
>> "No query Unable to fetch row error".
>>
>> How can this be? I could not find any problems working with the 
>> database in our code.
>>
>> We do it so:
>>
>> 1. Make sure the table exists:
>>
>> "CREATE TABLE IF NOT EXISTS miscData (Name TEXT, Value BLOB, PRIMARY 
>> KEY (Name))"
>>
>> 2. Write value to the table:
>>
>> QSqlQuery query(m_db);
>> query.prepare("REPLACE INTO miscData (Name, Value) VALUES (:Name, 
>> :Value)");
>> query.bindValue(":Name", "UUID");
>> query.bindValue(":Value", UuidByteArray);
>>
>> if (!query.exec())
>> {
>>      // here we're getting this error....
>> }
>>
>> What are the possible reasons of this error?
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> https://lists.qt-project.org/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest


More information about the Interest mailing list