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

Crash: Infinity values in SQLite [iOS] #4

Open
brodycj opened this issue Jan 12, 2016 · 0 comments
Open

Crash: Infinity values in SQLite [iOS] #4

brodycj opened this issue Jan 12, 2016 · 0 comments

Comments

@brodycj
Copy link
Member

brodycj commented Jan 12, 2016

As reported by @reconka in storesafe/cordova-sqlite-storage/issues/405:

I noticed the IOS application crash when I try to select rows which contains infinite number.

here is my simple test:

document.addEventListener("deviceready", onDeviceReady, false);
      function onDeviceReady() {
        var db = window.sqlitePlugin.openDatabase("Database", "1.0", "Demo", -1);

        db.transaction(function(tx) {
          tx.executeSql('DROP TABLE IF EXISTS test_table');
          tx.executeSql('CREATE TABLE IF NOT EXISTS test_table (id REAL)');

          tx.executeSql("INSERT INTO test_table (id) VALUES (?)", ['9e999'], function(tx, res) {
          console.log("insertId: " + res.insertId +  " -- probably 1"); // check #18/#38 is fixed
          alert("insertId: " + res.insertId  + " -- should be valid");

            db.transaction(function(tx) {
              tx.executeSql("SELECT id from test_table;", [], function(tx, res) {
                 alert("res.rows.length: " + res.rows.length  + " -- should be 1");
              });
            });

          }, function(e) {
            console.log("ERROR: " + e.message);
          });
        });
       }

And ERROR msg:
** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid number value (infinite) in JSON write'

Will be fixed in this version.

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

1 participant