Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load password protected sqlite from external storage #8

Open
firomero opened this issue Sep 30, 2016 · 2 comments
Open

Load password protected sqlite from external storage #8

firomero opened this issue Sep 30, 2016 · 2 comments

Comments

@firomero
Copy link

I want to know how to load an external database with password protected. Currently I can load an external database without password protected, but trying to load a protected one:

a statement error callback did not return false: an unknown error was returned: code :0, sqliteCode:1, message: -

Here is my code

  function OpenCustom(path, filename, key) {
        var db = window.sqlitePlugin.openDatabase({name: filename, key:key ,androidDatabaseLocation: path},function () {

            navigator.notification.alert('Database is queried');
            db.transaction(
                function (tx) {
                    tx.executeSql("insert into customerAccounts (firstname, lastname, acctNo) values ('firo"+Math.random()+"','fr"+Math.random()+"','"+Math.random()+"');",[],function(){console.log('ok')},function(statement,error){alert(JSON.stringify(error));});
                    tx.executeSql("SELECT * FROM customerAccounts;",[],function (tx, resultSet) {
                        for (var i=0; i<resultSet.rows.length; ++i){
                            $scope.clients.push(JSON.stringify(resultSet.rows.item(i)));
                        }
                        alert(JSON.stringify(resultSet.rows.length));

                    },function (tx,error) {
                        navigator.notification.alert('select error database'+JSON.stringify(error));
                    });
                },function (error)
                {
                    navigator.notification.alert('Populate database error: ' + error.message);

                }

            );

        }, function (error) {
            navigator.notification.alert('Open database ERROR: ' + JSON.stringify(error));
        });


    }

Using Cordova 6.3.1 deploying in Android 4.4.2.

Best regards

@brodycj
Copy link
Contributor

brodycj commented Oct 18, 2016

This version will never support encrypted databases. Encrypted databases are supported by Cordova-sqlcipher-adapter. Combining SQLCipher encryption with user-specified Android database path is under future consideration.

@zhangzsan
Copy link

I have the same problem, is there any plugin to solve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants