Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Using SQLite with V-PLay

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #9225

    Cal

    I have a mysql database that i have imported into a sqlite database with a utility.

    My V-PlaY app needs to make use of this database underĀ  android windows and linux ports

    Can anyone tell me where to place the database. i tried putting it in the project directory but i get file

    not found when i try to open using this javascript code

     

    function openDatabase() {
    console.log("trying to open");
    var db = Sql.openDatabaseSync("myDatabase", "1.0", "The  Database", 1000000);
    
    db.transaction(
    function(tx) {
    var rs = tx.executeSql('SELECT * FROM myTable');
    
    var r = ""
    for(var i = 0; i < rs.rows.length; i++) {
    console.log("Field1 " +rs.rows.item(i).field1);
    console.log("Field2 " + rs.rows.item(i).field2);
    }
    }
    )

     

    #9226

    Alex
    Felgo Team

    Hi,

    Unfortunately that’s not that easy as QML databases are always read from a specific location.

    If you want to use an existing database you have to copy it to a write-able location initially. Just bundle the database with your application and then copy it to the engine’s offline storage path (where all databases opened from QML are stored) retrieved with “engine.offlineStoragePath()” from your main.cpp file (you can also check if it already exists to prevent an overwrite by accident).

    Best,

    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded