Results 1 to 2 of 2

Thread: QSqlRecord double precision

  1. #1
    Join Date
    Nov 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default QSqlRecord double precision

    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

    Qt Code:
    1. QSqlQuery getTreesquery(dbsrc);
    2. getTreesquery.setNumericalPrecisionPolicy(QSql::HighPrecision); // database precision also set to high
    3.  
    4. getTreesquery.exec("SELECT * FROM Objects WHERE yada yada");
    5.  
    6. while (getTreesquery.next())
    7. {
    8. double gpsLatitude = getTreesquery.record().value(eGOF_LATITUDE).toDouble(); // only six digits
    9. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Nov 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSqlRecord double precision

    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.

Similar Threads

  1. how to set double precision
    By saman_artorious in forum Qt Programming
    Replies: 4
    Last Post: 28th February 2013, 00:48
  2. Print floating and double precision number
    By marc2050 in forum Newbie
    Replies: 2
    Last Post: 17th May 2011, 08:15
  3. Replies: 7
    Last Post: 28th December 2010, 20:27
  4. The precision range of double
    By nikhilqt in forum Qt Programming
    Replies: 14
    Last Post: 8th July 2009, 15:08
  5. double precision or what?
    By mickey in forum General Programming
    Replies: 7
    Last Post: 20th February 2007, 20:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.