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

Insertion into Boolean columns doesn't work #59

Open
roddyyaga opened this issue Dec 10, 2019 · 0 comments
Open

Insertion into Boolean columns doesn't work #59

roddyyaga opened this issue Dec 10, 2019 · 0 comments

Comments

@roddyyaga
Copy link

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.

@roddyyaga roddyyaga changed the title Boolean columns don't work Insertion into Boolean columns doesn't work Dec 10, 2019
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

1 participant