Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
5.15.15, 6.0
-
None
-
-
373ae6cbd (dev)
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.