I have a working Qt application that uses MySQL as a Database, but I decided to change the database to Sqlite in order to deploy on android. I created the same DB in Sqlite with the same data and tables structure. I changed the connection to the Sqlite successfully.
By testing the App (in Desktop) I found that some queries works fine with both Sqlite and MySQL, but in some other places the query doesn't return any data in Sqlite while working fine in MySQL.
Its not a query problem, because I changed the Query to a simple SELECT * FROM TABLE_NAME and I still get the same problem.
Here is a simple code snippet
QSqlQuery qry;
qry.prepare("SELECT * FROM users;");
if( !qry.exec() ){
qDebug()<< qry.lastError().text().toLatin1();
qDebug()<< "data" ;
}
else if (qry.size() < 1) {
qDebug()<< "There is no users" << qry.size();
}
else {
qDebug()<< "It Works !!" << qry.size();
}
While using Sqlite I always get there is no users -1 But in MySQL it returns the right number of the rows in the table.
Any suggestion what the problem might be! Is it related to speed or something?