You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can deduce that PR #61 (andpor/react-native-sqlite-storage#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.
I am mixed whether or not to fix this. (I am leaning towards it right now.) Some major benefits I can think of:
one less deviation from the spec
possible benefit for an experienced SQLite user who depends on the statement in https://www.sqlite.org/datatype3.html#section_2_1: "... Boolean values are stored as integers 0 (false) and 1 (true)."
one less bug/deviation to document
New applications would not depend on non-compliant behavior. I can think of the following example: An application could depend on using boolean true/false in JavaScript and expect the string value ("true"/"false") to actually show up somewhere such as a human-readable report document or GUI.
Some drawbacks:
Yet another difference from Web SQL behavior that could potentially affect an experienced Web SQL developer and would need to be documented
Change in behavior from older versions that could potentially break an existing application. An application that is technically non-compliant could depend on using boolean true/false in JavaScript and expects the string value ("true"/"false") to actually show up somewhere (such as a human-readable report document or GUI).
Any other comments and suggestions would be appreciated.
The text was updated successfully, but these errors were encountered:
Both Web SQL and this plugin bind boolean
true
andfalse
values as string values ("true" and "false"). The change in andpor/react-native-sqlite-storage#61 which was eventually accepted fixed andpor / react-native-sqlite-storage to bindtrue
andfalse
as 1 and 0. As I said in andpor/react-native-sqlite-storage#63 (comment) I think change in andpor/react-native-sqlite-storage#61 is correct:I am mixed whether or not to fix this. (I am leaning towards it right now.) Some major benefits I can think of:
true
/false
in JavaScript and expect the string value ("true"/"false") to actually show up somewhere such as a human-readable report document or GUI.Some drawbacks:
true
/false
in JavaScript and expects the string value ("true"/"false") to actually show up somewhere (such as a human-readable report document or GUI).Any other comments and suggestions would be appreciated.
The text was updated successfully, but these errors were encountered: