summaryrefslogtreecommitdiffstats
path: root/src/plugins/sqldrivers
diff options
context:
space:
mode:
authorAndy Shaw <andy.shaw@qt.io>2020-08-02 01:40:37 +0200
committerAndy Shaw <andy.shaw@qt.io>2020-09-08 08:02:14 +0200
commit13fe0ab5de63871cdacd41a68608b97b29edb89d (patch)
tree91cd83f62fdae7bc44962e37c933a5e39ae7d536 /src/plugins/sqldrivers
parent5fbb17c39785ed2c80219c9c0ea97879e371d490 (diff)
Interbase: Correctly read/write arrays to the database
The fix ensures that it can find the column for the array correctly when reading/writing and also handles the integer typed arrays correctly too. Pick-to: 5.15 Fixes: QTBUG-83409 Change-Id: I92d982bdf0927e6ebc6dce84fec9ad6c44c26c25 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'src/plugins/sqldrivers')
-rw-r--r--src/plugins/sqldrivers/ibase/qsql_ibase.cpp20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
index 4c1178f3c3..1754492fe7 100644
--- a/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
+++ b/src/plugins/sqldrivers/ibase/qsql_ibase.cpp
@@ -487,20 +487,6 @@ static QList<QVariant> toList(char** buf, int count, T* = 0)
}
return res;
}
-/* char** ? seems like bad influence from oracle ... */
-template<>
-QList<QVariant> toList<long>(char** buf, int count, long*)
-{
- QList<QVariant> res;
- for (int i = 0; i < count; ++i) {
- if (sizeof(int) == sizeof(long))
- res.append(int((*(long*)(*buf))));
- else
- res.append((qint64)(*(long*)(*buf)));
- *buf += sizeof(long);
- }
- return res;
-}
static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
short* numElements, ISC_ARRAY_DESC *arrayDesc)
@@ -531,7 +517,7 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
}
break; }
case blr_long:
- valList = toList<long>(&buffer, numElements[dim], static_cast<long *>(0));
+ valList = toList<int>(&buffer, numElements[dim], static_cast<int *>(0));
break;
case blr_short:
valList = toList<short>(&buffer, numElements[dim]);
@@ -581,7 +567,7 @@ QVariant QIBaseResultPrivate::fetchArray(int pos, ISC_QUAD *arr)
return list;
QByteArray relname(sqlda->sqlvar[pos].relname, sqlda->sqlvar[pos].relname_length);
- QByteArray sqlname(sqlda->sqlvar[pos].aliasname, sqlda->sqlvar[pos].aliasname_length);
+ QByteArray sqlname(sqlda->sqlvar[pos].sqlname, sqlda->sqlvar[pos].sqlname_length);
isc_array_lookup_bounds(status, &ibase, &trans, relname.data(), sqlname.data(), &desc);
if (isError(QT_TRANSLATE_NOOP("QIBaseResult", "Could not find array"),
@@ -768,7 +754,7 @@ bool QIBaseResultPrivate::writeArray(int column, const QList<QVariant> &list)
ISC_ARRAY_DESC desc;
QByteArray relname(inda->sqlvar[column].relname, inda->sqlvar[column].relname_length);
- QByteArray sqlname(inda->sqlvar[column].aliasname, inda->sqlvar[column].aliasname_length);
+ QByteArray sqlname(inda->sqlvar[column].sqlname, inda->sqlvar[column].sqlname_length);
isc_array_lookup_bounds(status, &ibase, &trans, relname.data(), sqlname.data(), &desc);
if (isError(QT_TRANSLATE_NOOP("QIBaseResult", "Could not find array"),