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

Application crash: Getting EXC_BAD_ACCESS when trying to use transaction.executeSql #65

Open
shashanktiwary opened this issue Sep 23, 2017 · 2 comments

Comments

@shashanktiwary
Copy link

My application is crashing due to EXC_BAD_ACCESS exception when trying to use transaction.executeSql in loop (10 iterations). This is only happen for iOS 10 and above. Android build is working fine.

Application code:

instance.transaction(function (tx) {
    for (var i = 0; i < sqls.length; i++) {
        lastSql = sqls[i];
        lastParam = params[i];
        if (i == sqls.length - 1) {
            tx.executeSql(sqls[i], params[i], callback, errorRollBack);
        } else {
            tx.executeSql(sqls[i], params[i], function () {}, errorRollBack);
        }
    }
}, function (e) {
    callback(e);
});

I tried all the test code as suggested and documented here and all of them are working as expected.

Environment:
Cordova@7.0.1
cordova-ios@4.4.0
cordova-sqlite-ext@0.10.5
Xcode@8.3.3

Please see below
screen shot 2017-09-23 at 10 08 45 pm

Please let me know if this need further information.

@shashanktiwary
Copy link
Author

After spending a long night with this issue, finally I got the exact problem. The issue is related to maximum number of terms one can use in select statement (SQLITE_MAX_COMPOUND_SELECT). My application was trying to insert more than 500 of records using UNION SELECT in on go.

The exact issue was

too many terms in compound SELECT

For solution I batched my insert operation in smaller chuck.

@brodycj
Copy link
Owner

brodycj commented Sep 24, 2017

Reopening as a bug, plugin should report an error rather than crashing in case of this kind of input.

Also marking as an enhancement, I can imagine people may want to add more than 500 rows at a time. No promise when I will get a chance to deliver this enhancement.

Thanks @shashanktiwary for reporting.

@brodycj brodycj reopened this Sep 24, 2017
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

2 participants