[Solved] Could anyone tell me if it's possible to apply QSqlDatabase to handle an Android sqlite file?



  • Hi, All:
    Recently, I want to show data in Android sqlite file on a GUI application based on QT.
    However, I failed to use QSqlDatabase to get the total tables in file.
    It always says only "1" table in file, and, if I use another non-free software to see the file, I get 17 tables.
    So, I guess something wrong here.

    Is it possible to handle a database file retrieved from Android phone in a QT-based application?

    Thanks a lot.

    BR,
    Pico



  • Welcome pico, remember that Qt in not QT (quicktime).



  • Are you using this function?
    "QSqlDatabase::tables":http://doc.qt.nokia.com/stable/qsqldatabase.html#tables

    this return a QStringList.

    [quote author="pico" date="1292337516"]Hi, All:
    Recently, I want to show data in Android sqlite file on a GUI application based on QT.
    However, I failed to use QSqlDatabase to get the total tables in file.
    It always says only "1" table in file, and, if I use another non-free software to see the file, I get 17 tables.
    So, I guess something wrong here.

    Is it possible to handle a database file retrieved from Android phone in a QT-based application?

    Thanks a lot.

    BR,
    Pico[/quote]



  • It should be working . Qt SQLite plugin is based on sqlite.org.



  • Hi, Stuk:
    Thanks, I will always use Qt from now on.

    Yes, I use QSqlDatabase::tables to get QStringList.
    But, I use QStringList.::size() to check its number, I only get 1 instead of 17.
    Could you please tell me what I could do?



  • This is very strange are you try with a different sqlite with many tables?
    Sqlite is sqlite everywhere.

    [quote author="pico" date="1292381524"]Hi, Stuk:
    Thanks, I will always use Qt from now on.

    Yes, I use QSqlDatabase::tables to get QStringList.
    But, I use QStringList.::size() to check its number, I only get 1 instead of 17.
    Could you please tell me what I could do?
    [/quote]



  • Hi, Stuk:
    I don't try other sqlite with many tables. I also try to open this file with SQliteman, but, it fails.
    Only "SQlite Expert Professional 3" could open it with correct table lists now.
    Do I need to update Qt to v4.7?

    Thanks



  • Mmm, try open this file "link":http://jump.fm/FDAXP
    it have 3 tables.

    [quote author="pico" date="1292405590"]Hi, Stuk:
    I don't try other sqlite with many tables. I also try to open this file with SQliteman, but, it fails.
    Only "SQlite Expert Professional 3" could open it with correct table lists now.
    Do I need to update Qt to v4.7?

    Thanks

    [/quote]



  • [quote author="pico" date="1292405590"]Do I need to update Qt to v4.7?[/quote]
    Upgrading to the latest stable version is usually a good idea, yes.



  • Hi, All:
    After upgrading to v4.7, the return result is OK.
    Thanks a lot.

    BR,



  • Great !


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.