storesafe / cordova-sqlite-evcore-extbuild-free

Cordova sqlite plugin with Android performance enhancements for PhoneGap Build, GPL v3 or commercial license options
Other
24 stars 13 forks source link

Hanging transaction in case of double-quotes in a result row key #51

Open brodycj opened 5 years ago

brodycj commented 5 years ago

Reproduction test case:

        it(suiteName + 'Inline US-ASCII string test with double-quotes in result key', function(done) {
          var db = openDatabase('Inline-string-test-with-double-quotes-in-result-key.db');

          expect(db).toBeDefined();

          db.transaction(function(tx) {
            expect(tx).toBeDefined();

            tx.executeSql('SELECT UPPER("Some US-ASCII text")', null, function(tx_ignored, rs) {
              expect(rs).toBeDefined();
              expect(rs.rows).toBeDefined();
              expect(rs.rows.length).toBe(1);
              expect(rs.rows.item(0)).toEqual({
                'UPPER("Some US-ASCII text")' : 'SOME US-ASCII TEXT'
              });

              // Close (plugin only) & finish:
              (isWebSql) ? done() : db.close(done, done);
            });
          }, function(error) {
            // NOT EXPECTED:
            expect(false).toBe(true);
            expect(error.message).toBe('--');
            // Close (plugin only) & finish:
            (isWebSql) ? done() : db.close(done, done);
          });
        }, MYTIMEOUT);

discovered while working on a simpler JSON-based sqlite plugin based on brodysoft/Android-sqlite-evcore-native-driver-free for a possible redesign (xpbrew/cordova-sqlite-storage#548)

P.S. Here is some relevant log output from logcat:

08-20 11:11:59.367 12313 12313 D SystemWebChromeClient: file:///android_asset/www/index.html: Line 1 : Uncaught SyntaxError: Unexpected identifier
08-20 11:11:59.367 12313 12313 I chromium: [INFO:CONSOLE(1)] "Uncaught SyntaxError: Unexpected identifier", source: file:///android_asset/www/index.html (1)

The cause is that the evcore-native-driver does not properly convert result column keys into JSON format.