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
On line 58 of query.mll, the function used to convert strings to Booleans Ppx_mysql_runtime.bool_of_string takes a string of an integer (e.g. "1" or "0") as input, which fits with how Booleans are stored in MySQL. But for converting Booleans to strings, Stdlib.string_of_bool is used, which converts false to "false" rather than "0". Therefore it is not possible to use ppx_mysql for Booleans.
Proposed fix:
In query.mll, replace Stdlib.string_of_bool with fun b -> if b then "1" else "0" or similar.
The text was updated successfully, but these errors were encountered:
roddyyaga
changed the title
Boolean columns don't work
Insertion into Boolean columns doesn't work
Dec 10, 2019
On line 58 of query.mll, the function used to convert strings to Booleans
Ppx_mysql_runtime.bool_of_string
takes a string of an integer (e.g."1"
or"0"
) as input, which fits with how Booleans are stored in MySQL. But for converting Booleans to strings,Stdlib.string_of_bool
is used, which convertsfalse
to"false"
rather than"0"
. Therefore it is not possible to use ppx_mysql for Booleans.Proposed fix:
In query.mll, replace
Stdlib.string_of_bool
withfun b -> if b then "1" else "0"
or similar.The text was updated successfully, but these errors were encountered: