summaryrefslogtreecommitdiffstats
path: root/src/sql
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-09 11:03:54 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-09 11:03:54 (GMT)
commit8bc84e2180e1d5819b372f4cd8c236b853145803 (patch)
tree6c5e6a8b6a1750e2484fd34f48be662fcf51959f /src/sql
parentd641198fa71fadd243e84dfdf02b9a0536a27b3f (diff)
parent3b1e30bb1d6651a626aba1f6b8883f5524598ed3 (diff)
downloadQt-8bc84e2180e1d5819b372f4cd8c236b853145803.zip
Qt-8bc84e2180e1d5819b372f4cd8c236b853145803.tar.gz
Qt-8bc84e2180e1d5819b372f4cd8c236b853145803.tar.bz2
Merge commit 'origin/master' into 4.6-merged
Conflicts: src/corelib/kernel/qcoreevent.cpp src/corelib/tools/qdumper.cpp src/gui/kernel/qwidget.cpp src/gui/kernel/qwidget_p.h src/gui/kernel/qwidget_s60.cpp src/gui/text/qfontdatabase.cpp src/network/access/qnetworkreplyimpl.cpp src/sql/drivers/ibase/qsql_ibase.cpp src/testlib/qtestcase.cpp src/testlib/testlib.pro tests/auto/network-settings.h tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp tests/auto/qobjectrace/tst_qobjectrace.cpp tests/auto/qsqldatabase/tst_qsqldatabase.cpp tools/configure/configureapp.cpp translations/qt_ru.ts
Diffstat (limited to 'src/sql')
-rw-r--r--src/sql/drivers/oci/qsql_oci.cpp9
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp7
-rw-r--r--src/sql/drivers/psql/qsql_psql.cpp8
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp2
-rw-r--r--src/sql/kernel/qsqlcachedresult.cpp5
5 files changed, 19 insertions, 12 deletions
diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp
index d5fb10f..617f116 100644
--- a/src/sql/drivers/oci/qsql_oci.cpp
+++ b/src/sql/drivers/oci/qsql_oci.cpp
@@ -609,7 +609,7 @@ static QSqlField qFromOraInf(const OraFieldInfo &ofi)
QSqlField f(ofi.name, ofi.type);
f.setRequired(ofi.oraIsNull == 0);
- if (ofi.type == QVariant::String)
+ if (ofi.type == QVariant::String && ofi.oraType != SQLT_NUM && ofi.oraType != SQLT_VNU)
f.setLength(ofi.oraFieldLength);
else
f.setLength(ofi.oraPrecision == 0 ? 38 : int(ofi.oraPrecision));
@@ -1586,9 +1586,12 @@ void QOCICols::getValues(QVector<QVariant> &v, int index)
} else if ((d->q->numericalPrecisionPolicy() == QSql::LowPrecisionInt64)
&& (fld.typ == QVariant::LongLong)) {
qint64 qll = 0;
- OCINumberToInt(d->err, reinterpret_cast<OCINumber *>(fld.data), sizeof(qint64),
+ int r = OCINumberToInt(d->err, reinterpret_cast<OCINumber *>(fld.data), sizeof(qint64),
OCI_NUMBER_SIGNED, &qll);
- v[index + i] = qll;
+ if(r == OCI_SUCCESS)
+ v[index + i] = qll;
+ else
+ v[index + i] = QVariant();
break;
} else if ((d->q->numericalPrecisionPolicy() == QSql::LowPrecisionInt32)
&& (fld.typ == QVariant::Int)) {
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 6ceee82..e91ca56 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -255,9 +255,11 @@ static QVariant::Type qDecodeODBCType(SQLSMALLINT sqltype, const T* p, bool isSi
case SQL_SMALLINT:
case SQL_INTEGER:
case SQL_BIT:
- case SQL_TINYINT:
type = isSigned ? QVariant::Int : QVariant::UInt;
break;
+ case SQL_TINYINT:
+ type = QVariant::UInt;
+ break;
case SQL_BIGINT:
type = isSigned ? QVariant::LongLong : QVariant::ULongLong;
break;
@@ -1111,7 +1113,7 @@ QVariant QODBCResult::data(int field)
d->fieldCache[i] = qGetBinaryData(d->hStmt, i);
break;
case QVariant::String:
- d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length(), true);
+ d->fieldCache[i] = qGetStringData(d->hStmt, i, info.length(), d->unicode);
break;
case QVariant::Double:
switch(numericalPrecisionPolicy()) {
@@ -1536,6 +1538,7 @@ bool QODBCResult::exec()
values[i] = QVariant(QDateTime(QDate(dt.year, dt.month, dt.day),
QTime(dt.hour, dt.minute, dt.second, dt.fraction / 1000000)));
break; }
+ case QVariant::Bool:
case QVariant::Int:
case QVariant::UInt:
case QVariant::Double:
diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 0c92013..2c67c8d 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -1265,15 +1265,15 @@ QStringList QPSQLDriver::subscribedToNotificationsImplementation() const
void QPSQLDriver::_q_handleNotification(int)
{
PQconsumeInput(d->connection);
- PGnotify *notify = PQnotifies(d->connection);
- if (notify) {
- QString name(QLatin1String(notify->relname));
+ PGnotify *notify = 0;
+ while((notify = PQnotifies(d->connection)) != 0) {
+ QString name(QLatin1String(notify->relname));
if (d->seid.contains(name))
emit notification(name);
else
qWarning("QPSQLDriver: received notification for '%s' which isn't subscribed to.",
- qPrintable(name));
+ qPrintable(name));
qPQfreemem(notify);
}
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index 8e1091b..1b74fb9 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -117,8 +117,6 @@ public:
QSqlRecord rInf;
};
-static const uint initial_cache_size = 128;
-
QSQLiteResultPrivate::QSQLiteResultPrivate(QSQLiteResult* res) : q(res), access(0),
stmt(0), skippedStatus(false), skipRow(false), utf8(false)
{
diff --git a/src/sql/kernel/qsqlcachedresult.cpp b/src/sql/kernel/qsqlcachedresult.cpp
index ca51dc0..13e6d82 100644
--- a/src/sql/kernel/qsqlcachedresult.cpp
+++ b/src/sql/kernel/qsqlcachedresult.cpp
@@ -184,8 +184,11 @@ bool QSqlCachedResult::fetch(int i)
if (d->rowCacheEnd > 0)
setAt(d->cacheCount());
while (at() < i + 1) {
- if (!cacheNext())
+ if (!cacheNext()) {
+ if (d->canSeek(i))
+ break;
return false;
+ }
}
setAt(i);