KenCorbettJr / html5sql

A helper javascript module for creating and working with HTML5 Web Databases.
http://kencorbettjr.github.io/html5sql/
MIT License
83 stars 64 forks source link

Double quotes inside SQL strings cause crashes #6

Open AndreaSpinelli opened 10 years ago

AndreaSpinelli commented 10 years ago

Hi, cute piece of software!

The following code crashes:

var sql = 'insert into foo (bar) values ('baz " biz') ; insert into foo (bar) values ('barbaz'); html5sql.process(sql, function() {});

Trying to debug, I found that at line 99 of html5sql.js the input string is split in two, and the splice on line 102 is executed repeatedly, until i+1 goes outside the array and the program crashes.

I guess that the split at line 95 must be substituted by something more complex.

Thanks in advance for your attention.