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

executeSql hangs when sending boolean values as params #63

Closed
anativ opened this issue Jun 22, 2016 · 3 comments
Closed

executeSql hangs when sending boolean values as params #63

anativ opened this issue Jun 22, 2016 · 3 comments

Comments

@anativ
Copy link
Contributor

anativ commented Jun 22, 2016

When calling executeSql with boolean value as param the function hangs on IOS
no callback at all success / error
Pull request #61 converts boolean to 0/1

Update: it doesn't happen when running with Chrome debugger

@andpor
Copy link
Owner

andpor commented Jun 23, 2016

If we apply this change , it will be backward incompatible...
@brodybits - will it be enough to bump up the version to 3.1.0 ?

@brodycj
Copy link
Contributor

brodycj commented Jun 23, 2016

That's fine for me. I have a couple more suggestions:

  • make sure the boolean true and false values are covered by your the automatic test suite
  • document clearly that the boolean type (true and false values) are now properly supported

I think we can deduce that PR #61 is correct according to the draft Web SQL database standard [1] sections 4.2 and 5 (released in November 2010). Section 4.2 [2] specifies how to bind each "?" placeholder. According to section 5 [3]:

User agents must implement the SQL dialect supported by Sqlite 3.6.19.

When converting bound arguments to SQL data types, the JavaScript ToPrimitive abstract operation must be applied to obtain the raw value to be processed. [ECMA262].

We generally support SQLite 3.7.x and 3.8.x which should be very close to the "SQL dialect" supported by SQLite 3.6.19. According to ECMA 262 5.1 [4](June 2011) section 9.1 [5] there is no conversion from the Boolean type. Then according to [6] SQLite 3.x.x: "Boolean values are stored as integers 0 (false) and 1 (true)."

I am now considering whether or not to apply a similar fix to the Cordova sqlite plugin.

[1] https://www.w3.org/TR/webdatabase/
[2] https://www.w3.org/TR/webdatabase/#parsing-and-processing-sql-statements
[3] https://www.w3.org/TR/webdatabase/#web-sql
[4] http://www.ecma-international.org/ecma-262/5.1/
[5] http://www.ecma-international.org/ecma-262/5.1/#sec-9.1
[6] https://www.sqlite.org/datatype3.html#section_2_1

@andpor andpor closed this as completed Jun 25, 2016
@andpor
Copy link
Owner

andpor commented Jun 25, 2016

part of 3.1.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants