Cordova-plugin-sqlite-2 is not working

Hi Team,

Cordova-plugin-sqlite-2 is not working in my project.

What happens when you try it?

it crashes the app after build use on mobile

Can you explain what you mean? What kind of crash?

It sounds like the build is working ok - the problem is at runtime. Are there any messages on the Console? Are you running on Android or iOS?

i’m using an android build.

this function is not working, when i’m using app on android device

database.transaction(function (transaction) {

    //transaction.executeSql('DELETE FROM user');

    transaction.executeSql('SELECT * FROM user where User_Id= ' + userDetails.User_Id, [], function (ignored, resultSet) {

        var userfound = "0";

        var len = resultSet.rows.length;

       if(len > 0) {

            if (userDetails.User_Id == resultSet.rows.item(0).User_Id && userDetails.User_EditedOn != resultSet.rows.item(0).User_EditedOn) {

                userfound = "1";

            } else if (userDetails.User_Id == resultSet.rows.item(0).User_Id && userDetails.User_EditedOn == resultSet.rows.item(0).User_EditedOn) {

                userfound = "2";

            }

        }

        if (userfound == "0") {

            transaction.executeSql('INSERT INTO user VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)', [userDetails.User_Id, userDetails.UserType_ID, userDetails.User_Username, userDetails.User_Password, userDetails.User_Name, userDetails.User_Email, userDetails.User_Phone, userDetails.User_IsEmailVerified, userDetails.User_AddedOn, userDetails.User_AddedBy, userDetails.User_EditedOn, userDetails.User_EditedBy, userDetails.User_ActiveStatus, userDetails.User_DeleteStatus]);

        // alert("inserted");

        }

        if (userfound == "1") {

            transaction.executeSql("UPDATE user SET UserType_ID=?, User_Username=?, User_Password=?, User_Name=?, User_Email=?, User_Phone=?, User_IsEmailVerified=?, User_AddedOn=?, User_AddedBy=?, User_EditedOn=?, User_EditedBy=?, User_ActiveStatus=?, User_DeleteStatus=?  WHERE User_Id=?", [userDetails.UserType_ID, userDetails.User_Username, userDetails.User_Password, userDetails.User_Name, userDetails.User_Email, userDetails.User_Phone, userDetails.User_IsEmailVerified, userDetails.User_AddedOn, userDetails.User_AddedBy, userDetails.User_EditedOn, userDetails.User_EditedBy, userDetails.User_ActiveStatus, userDetails.User_DeleteStatus, userDetails.User_Id]);

        // alert("updated");

        }

    }, function (error) {

        console.log('INSERT user error: ' + error.message);

    });

});

How do you know it isn’t working? Is there an error message? What is it?

How about the answers to my other questions?

yes, when my app calling this function than the app is stuck

Once again: Are there any messages on the Console? Are you running on Android or iOS?

i didnt find any message.

i’m using on android

Are you using the Android Remote Debugger to check the Console?

No, we were using weinre for debugging the app.

Is this available on volt.build as well?

Weinte should work, but the Android remote debugger works better. Give it a try!