summaryrefslogtreecommitdiffstats
path: root/src/sql/drivers/ibase
diff options
context:
space:
mode:
authorBill King <bill.king@nokia.com>2009-06-18 03:57:51 (GMT)
committerBill King <bill.king@nokia.com>2009-06-21 23:04:53 (GMT)
commita290f3b64a4a77018845612eef15baa98fc0833a (patch)
tree9ab806dd7e0c3cf2a2264759a633aa68e1370d30 /src/sql/drivers/ibase
parentcb8cfe965d9e5716e4ffc14b90c1fefaab53d126 (diff)
downloadQt-a290f3b64a4a77018845612eef15baa98fc0833a.zip
Qt-a290f3b64a4a77018845612eef15baa98fc0833a.tar.gz
Qt-a290f3b64a4a77018845612eef15baa98fc0833a.tar.bz2
Stage 2 of incorporating database level precision policy.
All autotests pass now for all databases except DB2 (untested).
Diffstat (limited to 'src/sql/drivers/ibase')
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 0698f26..259a247 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -1103,6 +1103,19 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
// null value
QVariant v;
v.convert(qIBaseTypeName2(d->sqlda->sqlvar[i].sqltype, d->sqlda->sqlvar[i].sqlscale < 0));
+ if(v.type() == QVariant::Double) {
+ switch(numericalPrecisionPolicy()) {
+ case QSql::LowPrecisionInt32:
+ v.convert(QVariant::Int);
+ break;
+ case QSql::LowPrecisionInt64:
+ v.convert(QVariant::LongLong);
+ break;
+ case QSql::HighPrecision:
+ v.convert(QVariant::String);
+ break;
+ }
+ }
row[idx] = v;
continue;
}
@@ -1168,6 +1181,27 @@ bool QIBaseResult::gotoNext(QSqlCachedResult::ValueCache& row, int rowIdx)
row[idx] = QVariant();
break;
}
+ if (d->sqlda->sqlvar[i].sqlscale < 0) {
+ QVariant v = row[idx];
+ switch(numericalPrecisionPolicy()) {
+ case QSql::LowPrecisionInt32:
+ if(v.convert(QVariant::Int))
+ row[idx]=v;
+ break;
+ case QSql::LowPrecisionInt64:
+ if(v.convert(QVariant::LongLong))
+ row[idx]=v;
+ break;
+ case QSql::LowPrecisionDouble:
+ if(v.convert(QVariant::Double))
+ row[idx]=v;
+ break;
+ case QSql::HighPrecision:
+ if(v.convert(QVariant::String))
+ row[idx]=v;
+ break;
+ }
+ }
}
return true;
@@ -1339,7 +1373,6 @@ bool QIBaseDriver::hasFeature(DriverFeature f) const
case LastInsertId:
case BatchOperations:
case SimpleLocking:
- case LowPrecisionNumbers:
case FinishQuery:
case MultipleResultSets:
return false;
@@ -1349,6 +1382,7 @@ bool QIBaseDriver::hasFeature(DriverFeature f) const
case Unicode:
case BLOB:
case EventNotifications:
+ case LowPrecisionNumbers:
return true;
}
return false;