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

QSql fetching smaller data set

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 390 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 last edited by Ankit.Jain
    #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

    jsulmJ 1 Reply Last reply
    0
    • A Ankit.Jain

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on 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

      • Login

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