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

Semicolon in quoted text causes SQL statement to be split up #1

Closed zander-berg closed 13 years ago

zander-berg commented 13 years ago

Hi,

I just encountered the following problem. I am having a couple of INSERT statements inserting values that contain semicola like INSERT INTO mytable (id, name) VALUES (0, 'foo;bar'); I have all those INSERT statements in a single string but then 'sqlObjectCreator', which is called by 'process', decides to split up the INSERT statement by the semicolon which yields an "Error: unrecognized token" Is there any way to prevent this? Currently I can only think of producing an array that holds a single statement for each index ...

Best wishes Alexander Körschgen

KenCorbettJr commented 13 years ago

Alexander,

Thank you for finding this problem. It is true, sqlObjectCreator was built to split on every semicolon. I never thought about semicolons being inside properties when I created it this way.

Ever since you reported the issue I've been thinking of a way to resolve it and I finally found a way. It involves some regular expression checking for open strings but I am glad to report that if you download the latest version of html5sql this bug is fixed.

If you find any other bugs or have any other problems let me know. Thanks!