summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/db2
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-06-18 05:39:08 (GMT)
committerBill King <bill.king@nokia.com>2009-06-21 23:04:53 (GMT)
commitfbe1e69584746e6255b6ea6fede9080c96f5d4e2 (patch)
tree512f3e55b4218efe6020a542f9bc4a4f8bc87213 /src/sql/drivers/db2
parenta290f3b64a4a77018845612eef15baa98fc0833a (diff)
downloadQt-fbe1e69584746e6255b6ea6fede9080c96f5d4e2.zip
Qt-fbe1e69584746e6255b6ea6fede9080c96f5d4e2.tar.gz
Qt-fbe1e69584746e6255b6ea6fede9080c96f5d4e2.tar.bz2
Stage 3 of incorporating database level precision policy.
DB2 is now tested and working, which completes the drivers.
Diffstat (limited to 'src/sql/drivers/db2')
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index b6ca82d..da87460 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -1043,26 +1043,22 @@ QVariant QDB2Result::data(int field)
case QVariant::Double:
{
QString value=qGetStringData(d->hStmt, field, info.length() + 1, isNull);
- bool ok=false;
- switch(d->precisionPolicy) {
+ switch(numericalPrecisionPolicy()) {
case QSql::LowPrecisionInt32:
- v = new QVariant(value.toInt(&ok));
+ v = new QVariant(qGetIntData(d->hStmt, field, isNull));
break;
case QSql::LowPrecisionInt64:
- v = new QVariant(value.toLongLong(&ok));
+ v = new QVariant(qGetBigIntData(d->hStmt, field, isNull));
break;
case QSql::LowPrecisionDouble:
- v = new QVariant(value.toDouble(&ok));
+ v = new QVariant(qGetDoubleData(d->hStmt, field, isNull));
break;
case QSql::HighPrecision:
default:
// length + 1 for the comma
- v = new QVariant(value);
- ok = true;
+ v = new QVariant(qGetStringData(d->hStmt, field, info.length() + 1, isNull));
break;
}
- if(!ok)
- v = new QVariant();
break;
}
case QVariant::String:
@@ -1146,6 +1142,10 @@ void QDB2Result::virtual_hook(int id, void *data)
Q_ASSERT(data);
*static_cast<bool*>(data) = nextResult();
break;
+ case QSqlResult::DetachFromResultSet:
+ if (d->hStmt)
+ SQLCloseCursor(d->hStmt);
+ break;
default:
QSqlResult::virtual_hook(id, data);
}
@@ -1477,7 +1477,6 @@ bool QDB2Driver::hasFeature(DriverFeature f) const
case BatchOperations:
case LastInsertId:
case SimpleLocking:
- case LowPrecisionNumbers:
case EventNotifications:
return false;
case BLOB:
@@ -1485,6 +1484,8 @@ bool QDB2Driver::hasFeature(DriverFeature f) const
case MultipleResultSets:
case PreparedQueries:
case PositionalPlaceholders:
+ case LowPrecisionNumbers:
+ case FinishQuery:
return true;
case Unicode:
// this is the query that shows the codepage for the types: