QSql/PostgreSQL: allow blobs with more than 2^30 bytes

Due to limitations of QByteArray it was not possible to store more than
2^31 bytes. This was fixed in Qt6 so throw away the casts to int in the
postgres plugin

Fixes: QTBUG-79059
Change-Id: I8ae7276a04d4936bcf5ba6c413e3412f6c342ff5
Reviewed-by: Robert Szefner <robertsz27@interia.pl>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
(cherry picked from commit 4e2a94236998cd05753167953d9167793baf9942)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Christian Ehrlicher 2021-01-16 22:05:18 +01:00 committed by Qt Cherry-pick Bot
parent ab669173f8
commit cf848323a3

View File

@ -696,8 +696,8 @@ QVariant QPSQLResult::data(int i)
#endif #endif
case QMetaType::QByteArray: { case QMetaType::QByteArray: {
size_t len; size_t len;
unsigned char *data = PQunescapeBytea((const unsigned char*)val, &len); unsigned char *data = PQunescapeBytea(reinterpret_cast<const unsigned char *>(val), &len);
QByteArray ba(reinterpret_cast<const char *>(data), int(len)); QByteArray ba(reinterpret_cast<const char *>(data), len);
qPQfreemem(data); qPQfreemem(data);
return QVariant(ba); return QVariant(ba);
} }