Class: GDSQLite3encImport

GDSQLite3encImport()

Wrapper for sqlite3enc_import method

Constructor

new GDSQLite3encImport()

Source:

Methods

sqlite3enc_import(successCallback, errorCallback)

This method is to import pre-populated SQLite DB from www/data folder. It is used in combination with window.plugins.GDAppKineticsPlugin.copyFilesToSecureFileSystem to copy DB file from www/data to Dynamics secure container and then import DB using Dynamics SQLite API. Secure Database object will be returned. Use it to manipulate the data.
Parameters:
Name Type Description
successCallback function Callback to be invoked when upload has completed
errorCallback function Callback to be invoked upon error
Properties:
Name Type Description
srcFilename string Full path, within the secure file system, of the plain SQLite database file to be imported.
destFilename string Name of the database to be created (iOS: in "Documents" directory). If the database already exists, its contents will be overwritten.
Source:
Example
function success(dbFile) {
    console.log("Imported Database Path: " + dbFile.fullPath);
    var db = window.sqlitePlugin.openDatabase({ name: dbFile.name, iosDatabaseLocation: 'Documents' });
}

function fail(error) {
    alert(error.code);
}

requestFileSystem(LocalFileSystem.APPKINETICS, 0, function(gdFileSystem) {
    window.plugins.GDAppKineticsPlugin.copyFilesToSecureFileSystem(function(result) {
        var options = {create: false, exclusive: false};

        gdFileSystem.root.getFile("/data/sql/testDB.sqlite", options, function(fileEntry) {
            sqlite3enc_import(fileEntry.fullPath, "SQLite3enc.db", success, fail);
        }, fail);
    });
}, null);