From kde-commits Mon Feb 29 23:21:26 2016 From: Jaroslaw Staniek Date: Mon, 29 Feb 2016 23:21:26 +0000 To: kde-commits Subject: [kdb] src: Fix: Switching off the visibility of query fields hides data in the last field Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=145678809929599 Git commit a1d47334f8ae29067c02a039d118eca3e5c4f58d by Jaroslaw Staniek. Committed on 29/02/2016 at 23:16. Pushed by staniek into branch 'master'. Fix: Switching off the visibility of query fields hides data in the last fi= eld This is a fix for Query Designer with SQLite/MySQL/PostreSQL/Sybase. See https://bugs.kde.org/attachment.cgi?id=3D96684 for test file BUG:346839 FIXED-IN:2.9.11 Test Plan: Try the minimal example from https://bugs.kde.org/attachment.cgi?id=3D96684= , open query1 in design mode, set Visible=3Doff for id and a fields, switch= to data view. Field b has data loaded after this fix. Differential Revision: https://phabricator.kde.org/D829 (from calligra.git) M +9 -8 src/KDbCursor.cpp M +3 -3 src/KDbCursor.h M +31 -16 src/KDbQuerySchema.cpp M +19 -3 src/KDbQuerySchema.h M +15 -1 src/KDbQuerySchema_p.cpp M +10 -1 src/KDbQuerySchema_p.h M +11 -12 src/drivers/mysql/MysqlCursor.cpp M +3 -3 src/drivers/postgresql/PostgresqlCursor.cpp M +6 -14 src/drivers/sqlite/SqliteCursor.cpp M +6 -5 src/drivers/sybase/SybaseCursor.cpp http://commits.kde.org/kdb/a1d47334f8ae29067c02a039d118eca3e5c4f58d diff --git a/src/KDbCursor.cpp b/src/KDbCursor.cpp index c288b1c..4037ce0 100644 --- a/src/KDbCursor.cpp +++ b/src/KDbCursor.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2010 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -74,15 +74,16 @@ void KDbCursor::init() = if (m_query) { //get list of all fields - m_fieldsExpanded =3D new KDbQueryColumnInfo::Vector(); - *m_fieldsExpanded =3D m_query->fieldsExpanded( - m_containsRecordIdInfo ? KDbQuerySchema::W= ithInternalFieldsAndRecordId : KDbQuerySchema::WithInternalFields); - m_logicalFieldCount =3D m_fieldsExpanded->count() + m_visibleFieldsExpanded =3D new KDbQueryColumnInfo::Vector(); + *m_visibleFieldsExpanded =3D m_query->visibleFieldsExpanded( + m_containsRecordIdInfo ? KDbQuerySchema::WithInternalF= ieldsAndRecordId + : KDbQuerySchema::WithInternalF= ields); + m_logicalFieldCount =3D m_visibleFieldsExpanded->count() - m_query->internalFields().count() - (m_con= tainsRecordIdInfo ? 1 : 0); - m_fieldCount =3D m_fieldsExpanded->count(); + m_fieldCount =3D m_visibleFieldsExpanded->count(); m_fieldsToStoreInRecord =3D m_fieldCount; } else { - m_fieldsExpanded =3D 0; + m_visibleFieldsExpanded =3D 0; m_logicalFieldCount =3D 0; m_fieldCount =3D 0; m_fieldsToStoreInRecord =3D 0; @@ -114,7 +115,7 @@ KDbCursor::~KDbCursor() kdbCritical() << "can be destroyed with Conenction::deleteCurs= or(), not with delete operator!"; } } - delete m_fieldsExpanded; + delete m_visibleFieldsExpanded; delete m_queryParameters; } = diff --git a/src/KDbCursor.h b/src/KDbCursor.h index 17ed93f..2fa3434 100644 --- a/src/KDbCursor.h +++ b/src/KDbCursor.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2010 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -322,8 +322,8 @@ protected: bool m_buffering_completed; //!< true if we already have all records= stored in the buffer // = - //! Useful e.g. for value(int) method when we need access to schema de= f. - KDbQueryColumnInfo::Vector* m_fieldsExpanded; + //! Useful e.g. for value(int) method to obtain access to schema defin= ition. + KDbQueryColumnInfo::Vector* m_visibleFieldsExpanded; = //! Used by setOrderByColumnList() KDbQueryColumnInfo::Vector* m_orderByColumnList; diff --git a/src/KDbQuerySchema.cpp b/src/KDbQuerySchema.cpp index b324e41..3220261 100644 --- a/src/KDbQuerySchema.cpp +++ b/src/KDbQuerySchema.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2014 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -979,28 +979,33 @@ KDbQueryColumnInfo* KDbQuerySchema::columnInfo(const = QString& identifier, bool e : d->columnInfosByName.value(identifier); } = -KDbQueryColumnInfo::Vector KDbQuerySchema::fieldsExpanded(FieldsExpandedOp= tions options) const +KDbQueryColumnInfo::Vector KDbQuerySchema::fieldsExpandedInternal( + FieldsExpandedOptions options, bool onlyVisible) const { computeFieldsExpanded(); + KDbQueryColumnInfo::Vector *realFieldsExpanded =3D onlyVisible ? d->vi= sibleFieldsExpanded + : d->fiel= dsExpanded; if (options =3D=3D WithInternalFields || options =3D=3D WithInternalFi= eldsAndRecordId) { //a ref to a proper pointer (as we cache the vector for two cases) KDbQueryColumnInfo::Vector*& tmpFieldsExpandedWithInternal =3D - (options =3D=3D WithInternalFields) ? d->fieldsExpandedWithInt= ernal : d->fieldsExpandedWithInternalAndRecordId; + (options =3D=3D WithInternalFields) ? + (onlyVisible ? d->visibleFieldsExpandedWithInternal : d->f= ieldsExpandedWithInternal) + : (onlyVisible ? d->visibleFieldsExpandedWithInternalAndReco= rdId : d->fieldsExpandedWithInternalAndRecordId); //special case if (!tmpFieldsExpandedWithInternal) { //glue expanded and internal fields and cache it - const int size =3D d->fieldsExpanded->count() - + (d->internalFields ? d->internalFields->co= unt() : 0) - + ((options =3D=3D WithInternalFieldsAndReco= rdId) ? 1 : 0) /*ROWID*/; + const int internalFieldCount =3D d->internalFields ? d->intern= alFields->size() : 0; + const int fieldsExpandedVectorSize =3D realFieldsExpanded->siz= e(); + const int size =3D fieldsExpandedVectorSize + internalFieldCou= nt + + ((options =3D=3D WithInternalFieldsAndRecor= dId) ? 1 : 0) /*ROWID*/; tmpFieldsExpandedWithInternal =3D new KDbQueryColumnInfo::Vect= or(size); - const int fieldsExpandedVectorSize =3D d->fieldsExpanded->size= (); - for (int i =3D 0; i < fieldsExpandedVectorSize; i++) { - (*tmpFieldsExpandedWithInternal)[i] =3D d->fieldsExpanded-= >at(i); + for (int i =3D 0; i < fieldsExpandedVectorSize; ++i) { + (*tmpFieldsExpandedWithInternal)[i] =3D realFieldsExpanded= ->at(i); } - const int internalFieldCount =3D d->internalFields ? d->intern= alFields->size() : 0; if (internalFieldCount > 0) { - for (int i =3D 0; i < internalFieldCount; i++) { - (*tmpFieldsExpandedWithInternal)[fieldsExpandedVectorS= ize + i] =3D d->internalFields->at(i); + for (int i =3D 0; i < internalFieldCount; ++i) { + KDbQueryColumnInfo *info =3D d->internalFields->at(i); + (*tmpFieldsExpandedWithInternal)[fieldsExpandedVectorS= ize + i] =3D info; } } if (options =3D=3D WithInternalFieldsAndRecordId) { @@ -1014,17 +1019,18 @@ KDbQueryColumnInfo::Vector KDbQuerySchema::fieldsEx= panded(FieldsExpandedOptions return *tmpFieldsExpandedWithInternal; } = - if (options =3D=3D Default) - return *d->fieldsExpanded; + if (options =3D=3D Default) { + return *realFieldsExpanded; + } = //options =3D=3D Unique: QSet columnsAlreadyFound; - const int fieldsExpandedCount(d->fieldsExpanded->count()); + const int fieldsExpandedCount(realFieldsExpanded->count()); KDbQueryColumnInfo::Vector result(fieldsExpandedCount); //initial si= ze is set //compute unique list int uniqueListCount =3D 0; for (int i =3D 0; i < fieldsExpandedCount; i++) { - KDbQueryColumnInfo *ci =3D d->fieldsExpanded->at(i); + KDbQueryColumnInfo *ci =3D realFieldsExpanded->at(i); if (!columnsAlreadyFound.contains(ci->aliasOrName())) { columnsAlreadyFound.insert(ci->aliasOrName()); result[uniqueListCount++] =3D ci; @@ -1224,11 +1230,14 @@ void KDbQuerySchema::computeFieldsExpanded() const //prepare clean vector for expanded list, and a map for order informat= ion if (!d->fieldsExpanded) { d->fieldsExpanded =3D new KDbQueryColumnInfo::Vector(list.count()); + d->visibleFieldsExpanded =3D new KDbQueryColumnInfo::Vector(list.c= ount()); d->columnsOrderExpanded =3D new QHash(); } else {//for future: qDeleteAll(*d->fieldsExpanded); d->fieldsExpanded->clear(); d->fieldsExpanded->resize(list.count()); + d->visibleFieldsExpanded->clear(); + d->visibleFieldsExpanded->resize(list.count()); d->columnsOrderExpanded->clear(); } = @@ -1240,9 +1249,14 @@ void KDbQuerySchema::computeFieldsExpanded() const d->columnInfosByName.clear(); d->columnInfosByNameExpanded.clear(); i =3D -1; + int visibleIndex =3D -1; foreach(KDbQueryColumnInfo* ci, list) { i++; (*d->fieldsExpanded)[i] =3D ci; + if (ci->visible) { + ++visibleIndex; + (*d->visibleFieldsExpanded)[visibleIndex] =3D ci; + } d->columnsOrderExpanded->insert(ci, i); //remember field by name/alias/table.name if there's no such strin= g yet in d->columnInfosByNameExpanded if (!ci->alias.isEmpty()) { @@ -1287,6 +1301,7 @@ void KDbQuerySchema::computeFieldsExpanded() const } } } + d->visibleFieldsExpanded->resize(visibleIndex + 1); = //remove duplicates for lookup fields QHash lookup_dict; //used to fight duplicates and to upd= ate KDbQueryColumnInfo::indexForVisibleLookupValue() diff --git a/src/KDbQuerySchema.h b/src/KDbQuerySchema.h index b70f2e6..16331b8 100644 --- a/src/KDbQuerySchema.h +++ b/src/KDbQuerySchema.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2014 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -525,7 +525,7 @@ public: explicitly specify "t2.name" as the identifier to get the second colu= mn. */ KDbQueryColumnInfo* columnInfo(const QString& identifier, bool expande= d =3D true) const; = - /*! Options used in fieldsExpanded(). */ + /*! Options used in fieldsExpanded() and visibleFieldsExpanded(). */ enum FieldsExpandedOptions { Default, //!< All fields are returned even if= duplicated Unique, //!< Unique list of fields is return= ed @@ -575,7 +575,18 @@ public: This method's result is cached by KDbQuerySchema object. @todo js: UPDATE CACHE! */ - KDbQueryColumnInfo::Vector fieldsExpanded(FieldsExpandedOptions option= s =3D Default) const; + inline KDbQueryColumnInfo::Vector fieldsExpanded( + FieldsExpandedOptions options =3D Default) const + { + return fieldsExpandedInternal(options, false); + } + + /*! Like fieldsExpanded() but returns only visible fields. */ + inline KDbQueryColumnInfo::Vector visibleFieldsExpanded( + FieldsExpandedOptions options =3D Default) const + { + return fieldsExpandedInternal(options, true); + } = /*! @return list of fields internal fields used for lookup columns. */ KDbQueryColumnInfo::Vector internalFields() const; @@ -762,6 +773,11 @@ protected: = void computeFieldsExpanded() const; = + //! Used by fieldsExpanded(FieldsExpandedOptions) + //! and visibleFieldsExpanded(FieldsExpandedOptions options). + KDbQueryColumnInfo::Vector fieldsExpandedInternal(FieldsExpandedOption= s options, + bool onlyVisible) co= nst; + Private * const d; }; = diff --git a/src/KDbQuerySchema_p.cpp b/src/KDbQuerySchema_p.cpp index 18bc8ac..8cd6992 100644 --- a/src/KDbQuerySchema_p.cpp +++ b/src/KDbQuerySchema_p.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2014 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -28,9 +28,12 @@ KDbQuerySchema::Private::Private(KDbQuerySchema* q, Priv= ate* copy) , maxIndexWithAlias(-1) , visibility(64) , fieldsExpanded(0) + , visibleFieldsExpanded(0) , internalFields(0) , fieldsExpandedWithInternalAndRecordId(0) + , visibleFieldsExpandedWithInternalAndRecordId(0) , fieldsExpandedWithInternal(0) + , visibleFieldsExpandedWithInternal(0) , orderByColumnList(0) , autoincFields(0) , columnsOrder(0) @@ -48,6 +51,7 @@ KDbQuerySchema::Private::Private(KDbQuerySchema* q, Priva= te* copy) *this =3D *copy; // fieldsExpanded =3D 0; + visibleFieldsExpanded =3D 0; internalFields =3D 0; columnsOrder =3D 0; columnsOrderWithoutAsterisks =3D 0; @@ -59,7 +63,9 @@ KDbQuerySchema::Private::Private(KDbQuerySchema* q, Priva= te* copy) columnInfosByName.clear(); ownedVisibleColumns =3D 0; fieldsExpandedWithInternalAndRecordId =3D 0; + visibleFieldsExpandedWithInternalAndRecordId =3D 0; fieldsExpandedWithInternal =3D 0; + visibleFieldsExpandedWithInternal =3D 0; pkeyFieldsOrder =3D 0; fakeRecordIdCol =3D 0; fakeRecordIdField =3D 0; @@ -100,7 +106,9 @@ KDbQuerySchema::Private::~Private() delete internalFields; } delete fieldsExpandedWithInternalAndRecordId; + delete visibleFieldsExpandedWithInternalAndRecordId; delete fieldsExpandedWithInternal; + delete visibleFieldsExpandedWithInternal; } = //static @@ -148,6 +156,8 @@ void KDbQuerySchema::Private::clearCachedData() qDeleteAll(*fieldsExpanded); delete fieldsExpanded; fieldsExpanded =3D 0; + delete visibleFieldsExpanded; // NO qDeleteAll, items not owned + visibleFieldsExpanded =3D 0; if (internalFields) { qDeleteAll(*internalFields); delete internalFields; @@ -155,8 +165,12 @@ void KDbQuerySchema::Private::clearCachedData() } delete fieldsExpandedWithInternalAndRecordId; fieldsExpandedWithInternalAndRecordId =3D 0; + delete visibleFieldsExpandedWithInternalAndRecordId; + visibleFieldsExpandedWithInternalAndRecordId =3D 0; delete fieldsExpandedWithInternal; fieldsExpandedWithInternal =3D 0; + delete visibleFieldsExpandedWithInternal; + visibleFieldsExpandedWithInternal =3D 0; } } = diff --git a/src/KDbQuerySchema_p.h b/src/KDbQuerySchema_p.h index 24cc3c5..0bc7843 100644 --- a/src/KDbQuerySchema_p.h +++ b/src/KDbQuerySchema_p.h @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2014 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -132,6 +132,9 @@ public: /*! Temporary field vector for using in fieldsExpanded() */ KDbQueryColumnInfo::Vector *fieldsExpanded; = + /*! Like fieldsExpanded but only visible column infos; infos are not o= wned. */ + KDbQueryColumnInfo::Vector *visibleFieldsExpanded; + /*! Temporary field vector containing internal fields used for lookup = columns. */ KDbQueryColumnInfo::Vector *internalFields; = @@ -139,10 +142,16 @@ public: Contains not auto-deleted items.*/ KDbQueryColumnInfo::Vector *fieldsExpandedWithInternalAndRecordId; = + /*! Like fieldsExpandedWithInternalAndRecordId but only contains visib= le column infos; infos are not owned.*/ + KDbQueryColumnInfo::Vector *visibleFieldsExpandedWithInternalAndRecord= Id; + /*! Temporary, used to cache sum of expanded fields and internal field= s used for lookup columns. Contains not auto-deleted items.*/ KDbQueryColumnInfo::Vector *fieldsExpandedWithInternal; = + /*! Like fieldsExpandedWithInternal but only contains visible column i= nfos; infos are not owned.*/ + KDbQueryColumnInfo::Vector *visibleFieldsExpandedWithInternal; + /*! A list of fields for ORDER BY section. @see KDbQuerySchema::orderB= yColumnList(). */ KDbOrderByColumnList* orderByColumnList; = diff --git a/src/drivers/mysql/MysqlCursor.cpp b/src/drivers/mysql/MysqlCur= sor.cpp index 901db76..3b924f8 100644 --- a/src/drivers/mysql/MysqlCursor.cpp +++ b/src/drivers/mysql/MysqlCursor.cpp @@ -1,6 +1,6 @@ /* This file is part of the KDE project Copyright (C) 2003 Joseph Wenninger - Copyright (C) 2005-2010 Jaros=C5=82aw Staniek + Copyright (C) 2005-2016 Jaros=C5=82aw Staniek = This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -100,8 +100,8 @@ QVariant MysqlCursor::value(int pos) if (!d->mysqlrow || pos >=3D m_fieldCount || d->mysqlrow[pos] =3D=3D 0) return QVariant(); = - KDbField *f =3D (m_fieldsExpanded && pos < m_fieldsExpanded->count()) - ? m_fieldsExpanded->at(pos)->field : 0; + KDbField *f =3D (m_visibleFieldsExpanded && pos < m_visibleFieldsExpan= ded->count()) + ? m_visibleFieldsExpanded->at(pos)->field : 0; = //! @todo js: use MYSQL_FIELD::type here! = @@ -119,15 +119,14 @@ bool MysqlCursor::drv_storeCurrentRecord(KDbRecordDat= a* data) const if (d->numRows =3D=3D 0) return false; = -//! @todo js: use MYSQL_FIELD::type here! -//! see SqliteCursor::storeCurrentRecord() - - const int fieldsExpandedCount =3D m_fieldsExpanded ? m_fieldsExpanded-= >count() : INT_MAX; - const int realCount =3D qMin(fieldsExpandedCount, m_fieldsToStoreInRec= ord); - for (int i =3D 0; i < realCount; i++) { - KDbField *f =3D m_fieldsExpanded ? m_fieldsExpanded->at(i)->field = : 0; - if (m_fieldsExpanded && !f) - continue; + if (!m_visibleFieldsExpanded) {//simple version: without types + for (int i =3D 0; i < m_fieldCount; ++i) { + (*data)[i] =3D QString::fromUtf8(d->mysqlrow[i], d->lengths[i]= ); + } + return true; + } + for (int i =3D 0; i < m_fieldCount; ++i) { + KDbField *f =3D m_visibleFieldsExpanded->at(i)->field; bool ok; (*data)[i] =3D KDb::cstringToVariant(d->mysqlrow[i], f ? f->type()= : KDbField::Text, &ok, d->lengths[i]); diff --git a/src/drivers/postgresql/PostgresqlCursor.cpp b/src/drivers/post= gresql/PostgresqlCursor.cpp index 4a9b23c..760747a 100644 --- a/src/drivers/postgresql/PostgresqlCursor.cpp +++ b/src/drivers/postgresql/PostgresqlCursor.cpp @@ -1,6 +1,6 @@ /* This file is part of the KDE project Copyright (C) 2003 Adam Pigg - Copyright (C) 2010 Jaros=C5=82aw Staniek + Copyright (C) 2016 Jaros=C5=82aw Staniek = This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -220,8 +220,8 @@ QVariant PostgresqlCursor::pValue(int pos) const // postgresqlWarning() << "PostgresqlCursor::value - ERROR: requested pos= ition is greater than the number of fields"; const qint64 row =3D at(); = - KDbField *f =3D (m_fieldsExpanded && pos < qMin(m_fieldsExpanded->coun= t(), m_fieldCount)) - ? m_fieldsExpanded->at(pos)->field : 0; + KDbField *f =3D (m_visibleFieldsExpanded && pos < qMin(m_visibleFields= Expanded->count(), m_fieldCount)) + ? m_visibleFieldsExpanded->at(pos)->field : 0; // postgresqlDebug() << "pos:" << pos; = const QVariant::Type type =3D m_realTypes[pos]; diff --git a/src/drivers/sqlite/SqliteCursor.cpp b/src/drivers/sqlite/Sqlit= eCursor.cpp index be39fd8..2edc1f9 100644 --- a/src/drivers/sqlite/SqliteCursor.cpp +++ b/src/drivers/sqlite/SqliteCursor.cpp @@ -1,5 +1,5 @@ /* This file is part of the KDE project - Copyright (C) 2003-2010 Jaros=C5=82aw Staniek + Copyright (C) 2003-2016 Jaros=C5=82aw Staniek = This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -303,22 +303,14 @@ const char ** SqliteCursor::recordData() const = bool SqliteCursor::drv_storeCurrentRecord(KDbRecordData* data) const { - if (!m_fieldsExpanded) {//simple version: without types + if (!m_visibleFieldsExpanded) {//simple version: without types for (int i =3D 0; i < m_fieldCount; i++) { (*data)[i] =3D QString::fromUtf8((const char*)sqlite3_column_t= ext(d->prepared_st_handle, i)); } return true; } - const int maxCount =3D qMin(m_fieldCount, m_fieldsExpanded->count()); - // i - visible field's index, j - physical index - for (int i =3D 0, j =3D 0; i < m_fieldCount; i++, j++) { - while (j < maxCount && !m_fieldsExpanded->at(j)->visible) - j++; - if (j >=3D (maxCount /*+(m_containsROWIDInfo ? 1 : 0)*/)) { - //ERR! - break; - } - KDbField *f =3D (i >=3D m_fieldCount) ? 0 : m_fieldsExpanded->at(j= )->field; + for (int i =3D 0; i < m_fieldCount; ++i) { + KDbField *f =3D m_visibleFieldsExpanded->at(i)->field; // sqliteDebug() << "col=3D" << (col ? *col : 0); (*data)[i] =3D d->getValue(f, i); } @@ -330,8 +322,8 @@ QVariant SqliteCursor::value(int i) if (i < 0 || i > (m_fieldCount - 1)) //range checking return QVariant(); //! @todo allow disable range checking! - performance reasons - KDbField *f =3D (m_fieldsExpanded && i < m_fieldsExpanded->count()) - ? m_fieldsExpanded->at(i)->field : 0; + KDbField *f =3D (m_visibleFieldsExpanded && i < m_visibleFieldsExpande= d->count()) + ? m_visibleFieldsExpanded->at(i)->field : 0; return d->getValue(f, i); //, i=3D=3Dm_logicalFieldCount/*ROWID*/); } = diff --git a/src/drivers/sybase/SybaseCursor.cpp b/src/drivers/sybase/Sybas= eCursor.cpp index df5b03a..72aa803 100644 --- a/src/drivers/sybase/SybaseCursor.cpp +++ b/src/drivers/sybase/SybaseCursor.cpp @@ -143,8 +143,8 @@ QVariant SybaseCursor::value(int pos) if (!d->dbProcess || pos >=3D m_fieldCount) return QVariant(); = - KDbField *f =3D (m_fieldsExpanded && pos < m_fieldsExpanded->count()) - ? m_fieldsExpanded->at(pos)->field : 0; + KDbField *f =3D (m_visibleFieldsExpanded && pos < m_visibleFieldsExpan= ded->count()) + ? m_visibleFieldsExpanded->at(pos)->field : 0; = // db-library indexes its columns from 1 pos =3D pos + 1; @@ -178,11 +178,12 @@ bool SybaseCursor::drv_storeCurrentRecord(KDbRecordDa= ta* data) const // if (d->numRows<=3D0) // return false; = - const int fieldsExpandedCount =3D m_fieldsExpanded ? m_fieldsExpanded-= >count() : INT_MAX; + const int fieldsExpandedCount =3D m_visibleFieldsExpanded + ? m_visibleFieldsExpanded->count() : I= NT_MAX; const int realCount =3D qMin(fieldsExpandedCount, m_fieldsToStoreInRec= ord); for (int i =3D 0; i < realCount; i++) { - KDbField *f =3D m_fieldsExpanded ? m_fieldsExpanded->at(i)->field = : 0; - if (m_fieldsExpanded && !f) + KDbField *f =3D m_visibleFieldsExpanded ? m_visibleFieldsExpanded-= >at(i)->field : 0; + if (m_visibleFieldsExpanded && !f) continue; = long int columnDataLength =3D dbdatlen(d->dbProcess, i + 1);