In window XP, I failed to open a database file comes from Android phone.
Page |
1 |
Hi, Sir: I got a database file comes from Android phone, and I tried to do something on this file. So, I implement an AP to handle this file.
My original code is developed on Ubuntu, and this AP works fine. Then, I move this codebase to Window XP, and use Qt-Window version to recompile it. Everything is OK until I try to execute this AP to open an existing database file.- if (db.isValid()) {
- db.close();
- }
- //QMessageBox::warning(0,"Warning0",SESSION_NAME);
- db.setDatabaseName(fileName);
- if(!db.open()) {
- return;
- }
- /* Qt database open() (exactly the sqlite API sqlite3_open16())
- method does not check if it is really database. So the dummy
- select statement should perform a real "is it a database" check
- for us. */
- if (!q.exec()) {
- return;
- } else {
- isOpened = true;
19 replies
Would you PLEASE be patient!
3 and half hours and you’re moaning about no response. You’re not serious, are you?
If you want to know what’s going on, call QSqlDatabase::lastError() [doc.qt.nokia.com] on your db on the open and QSqlQuery::lastError() [doc.qt.nokia.com] on the failed query. They will tell you what happened.
Hi, Volker: Thanks for your reminders!! I am just too emotional…
And, after checking the error, it shows “No query Unable to fetch row”. But, I have no idea on why I get this error. Again, I have to say this AP works well under Ubuntu. So, Do I need to modify anything for that? Thanks a lot. BR, PicoAnd, after checking the error, it shows “No query Unable to fetch row”. But, I have no idea on why I get this error. Again, I have to say this AP works well under Ubuntu. So, Do I need to modify anything for that?
Is the database file available?
Is it in the right directory?
Is the sqlite version the same?
Hi, Volker:
This database is OK to perform action on Ubuntu on the same codes. And, for the version, I have no many ideas on that. However, I think it is 3.6.22. In addition, opening the database seems no error… Thanks a lot. BR, PicoIs the database file available?
Is it in the right directory?
Is the sqlite version the same?
Hi, Volker: I also guess this is a sqlite question, however, I am not familiar with sqlite. And, I also download the sqlite command line tool to test it. It works well…
And, I also use some other commercial tool to open it. It is OK, too. In addition, I find a command “Repair” in a tool. If I do it on those database files, I can open them by Qt’s sql dll. So, I would like to know if Qt’s sqlite driver doesn’t have error tolerance on mismatched SQL files. If so, does it mean I have to use another sqlite driver? Thanks a lot. BR, PicoHi, Sir: The link to this database file is http://dl.dropbox.com/u/21382345/blake_cruiser.db If possible, please help me to know what I do wrong.
Thanks a lot. BR, Pico[EDIT: fixed link, Volker]
Hi, Volker: This database file comes from Android phone. I just copy it out, and try to parse it.
But, I can use sqlite3_analyzer downloaded from “www.sqlite.org” to open it. So, I guess this might be related to version. If so, could you give me a piece of advice to solve the version issue? For example, could I get the updated library from Qt’s web for SQL? Or, something like that… BR, PicoOk, problem found: The SQLite version in Android is newer than that bundled with Qt. Actual problem is, that it is too new and contains a WAL feature [sqlite.org] that older versions cannot deal with.
- Android has SQLite 3.7.x
- Qt 4.7.1 has SQLite 3.6.19
I can easily change a working database file to be locked out of a 3.6.x client by changing that mentioned WAL flag.
The good news is: You can build the SQLite plugin of Qt with a newer version of SQLite. The docs have instructions on how to do this in section QSQLITE for SQLite [doc.qt.nokia.com] of the SQL Database Drivers [doc.qt.nokia.com] page. Just use the newest SQLite version from the webpage.
On Jira, there is an open bug report QTBUG-16607 [bugreports.qt.nokia.com] which requests an update of the built in SQLite version to 3.7.x. You can vote for it, this may accelerate it a bit.
You must log in to post a reply. Not a member yet? Register here!


