Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-124575

Firebird 5 empty result with decimal value

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15.15
    • SQL Support
    • None
    • Windows

    Description

      Dear 

      with driver Firebird 5 and NUMERIC fields we have empty query with fields with height digits .

      The table product1 has field price with 20 digits with 4 decimal places

       

      CREATE TABLE product1 (    
      id INT PRIMARY KEY,    
      price NUMERIC(20,4) -- Example: 20 digits with 4 decimal places);
      );
      INSERT INTO product1(id,price) values(1,40001.1234);
      INSERT INTO product1(id,price) values(2,40001.1234);
      INSERT INTO product1(id,price) values(3,40001.1234);
      SELECT sum(price) FROM product1;
      SELECT price FROM product1;
          QCoreApplication a(argc, argv);
          // Establishing connection to the Firebird database
          auto dir = QCoreApplication::applicationDirPath();
          QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
          db.setHostName("localhost"); // Replace with your Firebird server hostname
          db.setDatabaseName(QStringLiteral("%1/../database.fdb").arg(dir)); 
          db.setUserName("SYSDBA"); // Replace with your username
          db.setPassword("firebird"); // Replace with your password   
       if (!db.open()) {
              qDebug() << "Error: Failed to connect to database:" << db.lastError().text();
              return -1;
          } else {
              qDebug() << "Connected to database!";
          }
          QSqlQuery query("SELECT price FROM product1",db);
          while (query.next()) {
              qDebug() << query.value(0);
          }    // Perform your database operations here    // Closing the database connection
          db.close(); 

      The  query does not return values instead with few digits we have the result

       

      CREATE TABLE product2 (    
      id INT PRIMARY KEY,    
      price NUMERIC(10,4) -- Example: 10 digits with 4 decimal places
      );
      
      INSERT INTO product2(id,price) values(1,4001.1234);
      INSERT INTO product2(id,price) values(2,4001.1234);
      INSERT INTO product2(id,price) values(3,4001.1234);
      
       

       

      Attached you find the database.

       

      Attachments

        For Gerrit Dashboard: QTBUG-124575
        # Subject Branch Project Status CR V

        Activity

          People

            chehrlic Christian Ehrlicher
            pier77 Pier V
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change