Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSql fetching smaller data set
Forum Updated to NodeBB v4.3 + New Features

QSql fetching smaller data set

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 410 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ankit.Jain
    wrote on 7 Feb 2018, 08:01 last edited by Ankit.Jain 2 Jul 2018, 08:14
    #1

    Hi,
    I was checking a SQL->Qt link and found that the number of records fetched was lower than the number of tuples present in the SQL DB.

    Code:
    SQL Query

    select * from [Table Name] where TxTimestamp=0.08249259
    

    The number of tuples in table is 256, while the code :

    queryResult.exec(QString("select * from [TABLE NAME] where TxTimestamp="0.08249259"));
    int noOfRecords = queryResult.record().count();
    

    noOfRecords = 21.

    What might the problem I am facing?

    EDIT:

    Using:

    while(queryResult.next())
        {
        }
    

    to traverse the result iterates through all 256 inputs

    J 1 Reply Last reply 7 Feb 2018, 08:12
    0
    • A Ankit.Jain
      7 Feb 2018, 08:01

      Hi,
      I was checking a SQL->Qt link and found that the number of records fetched was lower than the number of tuples present in the SQL DB.

      Code:
      SQL Query

      select * from [Table Name] where TxTimestamp=0.08249259
      

      The number of tuples in table is 256, while the code :

      queryResult.exec(QString("select * from [TABLE NAME] where TxTimestamp="0.08249259"));
      int noOfRecords = queryResult.record().count();
      

      noOfRecords = 21.

      What might the problem I am facing?

      EDIT:

      Using:

      while(queryResult.next())
          {
          }
      

      to traverse the result iterates through all 256 inputs

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 7 Feb 2018, 08:12 last edited by
      #2

      @Ankit.Jain Use http://doc.qt.io/qt-5/qsqlquery.html#size
      QSqlRecord returned by record() is something different, see http://doc.qt.io/qt-5/qsqlquery.html#record
      http://doc.qt.io/qt-5/qsqlrecord.html#count "Returns the number of fields in the record."

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3

      1/2

      7 Feb 2018, 08:01

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved