kubo / ruby-oci8

Ruby-oci8 - Oracle interface for ruby
Other
169 stars 75 forks source link

Integer Unification in Ruby 2.4.0+ #145

Closed koic closed 7 years ago

koic commented 7 years ago

Summary

Ruby 2.4.0 unifies Fixnum and Bignum into Integer.

https://bugs.ruby-lang.org/issues/12005

Fix following deprecated warnings in Ruby 2.4.0+.

There are notes below. The following codes are for compatibility with 2.3 or lower.

0.class

# Ruby 2.3 or lower
0.class       #=> Fixnum
# Ruby 2.4 or higher
0.class       #=> Integer

(2**64).class

# Ruby 2.3 or lower
(2**64).class #=> Bignum
# Ruby 2.4 or higher
(2**64).class #=> Integer

I wrote assuming that (2**64) is big enough become Bignum.

And, it is unified with Integer for codes without problem.

oracle-enhanced

This PR is also confirmed by the following combinations.

Thanks.

kubo commented 7 years ago

Thank you! I don't accept this PR as it is. I want to accept changes in comments and reject changes in lib/oci8/comapt.rb and test/*. If changes in test/* are merged, Fixnum and Bignum tests are dropped for rubies before 2.4. I'll make minimum changes in files under not to warn constant ::Fixnum is deprecated and release a new ruby-oci8 version to include your previous PR. After that, I'll check other changes in this PR.

koic commented 7 years ago

I got it. Thanks for making minimum changes. I'm looking forward to the release. Thanks.

kubo commented 7 years ago

ruby-oci8 2.2.3 was released. Thank you!

koic commented 7 years ago

@kubo Thank you for release! May I resolve this PR conflict?

javornikolov commented 7 years ago

@kubo, @koic - in cursor.rb#L61-L62 we have a comment about bind_param:

To bind as number, Fixnum and Float are available, but Bignum is not supported.

Is that still true in some sense? Is there any limitation for the range of bind_param(:in, value) when the value is Integer, Fixnum, Bignum?

I'm doing some tests now with bind_param(:in, value) and I have a feeling that it's working fine with pretty big integers (beyond the range of Fixnum). Bit it could be something specific to my setup (ruby 2.4.0, Oracle 11.2).

kubo commented 7 years ago

@koic I'd appreciate it if you resolve the conflict. Could you revert the followings?

@javornikolov Thank you! No, that isn't true for long time. I wrote it 11 years ago and have not checked it again...

kubo commented 7 years ago

@koic, I merged it. Thank you!

koic commented 7 years ago

@kubo Thanks for your support. Many Thanks 🙏