Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.6.3, 4.7.0
-
68241a1d889b94156a63159fb7cdcffc10b9d397
Description
I was not able to create a test case to reproduce the issue but I have included a stack trace of an application that encounters the problem with Qt 4.6.3.
It looks like the problem arises if, for some reason, the driver is a QSqlNullDriver. Here is the suggested patch that seems fixing the problem.
diff --git a/src/sql/kernel/qsqldatabase.cpp b/src/sql/kernel/qsqldatabase.cpp index 022bc47..b3dad08 100644 --- a/src/sql/kernel/qsqldatabase.cpp +++ b/src/sql/kernel/qsqldatabase.cpp @@ -135,7 +135,7 @@ public: port(-1) { ref = 1; - if(driver) + if(driver && (driver != shared_null()->driver)) precisionPolicy = driver->numericalPrecisionPolicy(); else precisionPolicy= QSql::LowPrecisionDouble; @@ -1514,7 +1514,7 @@ void QSqlDatabase::setNumericalPrecisionPolicy(QSql::NumericalPrecisionPolicy pr Returns the current default precision policy for the database connection. - \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(), + \sa QSql::NumericalPrecisionPolicy, setNumericalPrecisionPolicy(), QSqlQuery::numericalPrecisionPolicy(), QSqlQuery::setNumericalPrecisionPolicy() */ QSql::NumericalPrecisionPolicy QSqlDatabase::numericalPrecisionPolicy() const