Unsolved SQLITE SELECT QUERY NOT PROPER WORKING IN QT4.8.6
-
Hii
I am working on qt4.8.6 with Linux os and I have issue with SQLite (version 3) "select" query.
The select query is working proper with large data on SQLite manger Tool but not in qt 4.8.6.Is there any dependency of using SQLite3 database with qt4.8.6 ?
Here is my code snippet:
QSqlQuery * query = DatabaseConnection::instance()->newSqlQuery(); query->clear(); query->prepare("SELECT File_ID FROM Test WHERE File_Path = :filepath AND File_Name = :filename;"); query->bindValue(":filepath", "Test1/"); query->bindValue(":filename", "test.txt"); if( ! query->exec()){ qDebug()<< "Error in sqlite query exection "<< query->lastError(); } qDebug()<<"query.isActive"<<query->isActive(); qDebug()<<"query.isSelect"<<query->isSelect(); //if(query->first()){ if(query->next()){ fileId = query->value(0).toInt(); // I am not able to reach here......... } else { qDebug()<<" NOT In next "<<query->size(); // Right now I am here..... } qDebug() << "fileId "<< fileId; delete query; query = 0;
// Where "DatabaseConnection" is my own Database class, used to create and delete the table.
My "Create table statement" is Like:
CREATE TABLE IF NOT EXISTS Test (File_Id INTEGER PRIMARY KEY NOT NULL,User_Id INTEGER,Updated_By INTEGER, File_Name TEXT,File_Size INTEGER,File_Type TEXT,File_Path TEXT,Is_Deleted INTEGER, Level INTEGER,Parent_Id INTEGER,Uploaded_On DATETIME ,Updated_On DATETIME,Is_Shared INTEGER, File_Input_Name TEXT);// See I have problem with only large database about 1000 records in db but it works fine with small data of around 50 records.
Is there any Solution of this problem?
Thanks
-
Hi and welcome to devnet,
Yes there's a dependency. The SQLite plugin uses either the bundled SQLite library or the one from your system when built.
What exact error are you getting ?
-
Thanks for your reply.
I am not getting any error while running select query, actually the output of this query is not right.
When running the select query in SQlite manager tool the fileId is correct but Why getting fileId = 0, when I run same select query into my Application via QT creator 4.8.6 ?
Is there any problem with large database in QT4.8.6 ?
-
Can you show the code where you call that query ?