PDA

View Full Version : QSqlRecord double precision



DavidBell
13th November 2016, 06:57
I am accessing data from an SQLite database created in another application (SQLiteStudio) that has a field that contains a double.

It all works ok except that I am only getting six significant digits (ie float) whereas the file In SQLiteStudio it has 11 significant digits.

Any help appreciated, need full precision for this case.

Code snip folows
David Bell



QSqlQuery getTreesquery(dbsrc);
getTreesquery.setNumericalPrecisionPolicy(QSql::Hi ghPrecision); // database precision also set to high

getTreesquery.exec("SELECT * FROM Objects WHERE yada yada");

while (getTreesquery.next())
{
double gpsLatitude = getTreesquery.record().value(eGOF_LATITUDE).toDoub le(); // only six digits
}

DavidBell
13th November 2016, 10:54
My mistake, I was using QString::number to build and INSERT command to put the value into a second database. Both QString::number & qDebug have default precision = 6.