Skip to content

Prepared statement with bignum primary key fails #828

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

Closed
fw42 opened this issue Mar 2, 2017 · 2 comments
Closed

Prepared statement with bignum primary key fails #828

fw42 opened this issue Mar 2, 2017 · 2 comments

Comments

@fw42
Copy link

fw42 commented Mar 2, 2017

I have a MySQL table with a bigint(20) primary key.

Using a query like SELECT * FROM table WHERE id = #{id} works fine.

However, using a prepared statement fails in some cases when the id is too big (bigger than what fits into a Fixnum, it seems).

statement = client.prepare("SELECT * FROM table WHERE id = ?")
statement.execute(18325422643391879579)
RangeError: bignum too big to convert into `long long'

With smaller ids, this same statement works.

Is this a known limitation or a bug?

Converting the id to a string using id.to_s before passing it to execute seems to be a working work around, which makes me think this might be a bug (if it is, I'm happy to take a look at fixing it, just want confirmation).

Thanks!

@kamipo
Copy link
Contributor

kamipo commented Mar 2, 2017

Seems fixed in 0.4.5. #764

@fw42
Copy link
Author

fw42 commented Mar 2, 2017

❤️ Thanks! Sorry for the noise.

@fw42 fw42 closed this as completed Mar 2, 2017
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

2 participants