Skip to content

Conversation

ghuysmans
Copy link
Contributor

No description provided.

According to the manual[1], C ints are tagged with MYSQL_TYPE_LONG.
Using MYSQL_TYPE_LONGLONG, the buffer got padded with zeros.
While it worked for positive ints, we got the unsigned interpretation of
negative ints, e.g. -1 became 4294967295 (0xFFFFFFFF00000000, LE).

[1]: https://dev.mysql.com/doc/c-api/5.7/en/c-api-prepared-statement-type-codes.html
@paurkedal
Copy link
Collaborator

I suggest we merge this, considering the past discussion in #54 and the fact that it fixes #57. To elaborate, the latter issue shows that the OCaml and C integers must match when we pass integers to MariaDB, since it does not honour the passed size field. The size field is probably meant for varchar and non-scalar fields. And long is the C integer type matching the word size.

@paurkedal paurkedal merged commit 50c3907 into ocaml-community:master Sep 20, 2024
@paurkedal
Copy link
Collaborator

Thanks, this is an important fix.

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

Successfully merging this pull request may close these issues.

2 participants