Fix SqliteCursor’s buffering
Needs ReviewPublic

Authored by jfita on Apr 25 2020, 8:12 PM.



The part dealing with cursor buffering for SQLite was in fact from the
time when the driver was only for SQLite2: sqlite_step() from back then
required a pointer to store the column data as strings, regardless of
the column’s type, and SqliteCursor kept these pointers in a QVector.

As far as i could see in Git’s log, when the driver was ported to
SQLite3 it never used this QVector, i guess because now SQLite3 can
return more than only strings, and when support for version 2 was
dropped that code was left as is, with no chance of being used because
neither cur_coldata nor the QVector were never updated.

I changed the buffer’s type from QVector<const char > to QVector<const
>. That way it can kept a copy of all the QVariants returned
by SqliteCursorData::getValue; it is very similar to what
drv_storeCurrentRecord and does with KDbRecordData. I did not make the
buffer a QVector<KDbRecordData> because then each row would keep a field

The only part i did not know what do about was the return value for
KDbCursor::recordData(), because its return type is const char and i
did not feel it right to convert all QVariants to char
. As i could
not find any user of this function in neither KEXI, KReport or KDb
itself, for now i just return NULL.

This fixes bug KEXI’s 420534 (“Report uses incorrect record/row in group
footer”) when using a SQLite-based database.


Diff Detail

R15 KDb
No Linters Available
No Unit Test Coverage
Build Status
Buildable 25897
Build 25915: arc lint + arc unit
jfita created this revision.Apr 25 2020, 8:12 PM
Restricted Application added a project: KDb. · View Herald TranscriptApr 25 2020, 8:12 PM
Restricted Application added a subscriber: Kexi-Devel-list. · View Herald Transcript
jfita requested review of this revision.Apr 25 2020, 8:12 PM