# \[ANN\] ruby-oci8 1.0.0

**URL:** <https://rubytalk.org/t/ann-ruby-oci8-1-0-0/42485>\
**Category:** ruby-talk\
**Created:** [25 November 2007 11:53 UTC](https://rubytalk.org/t/ann-ruby-oci8-1-0-0/42485 "2007-11-25T11:53:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KUBO\_Takehiro](https://avatars.discourse-cdn.com/v4/letter/k/3be4f8/32.png) [@KUBO\_Takehiro](https://rubytalk.org/u/KUBO_Takehiro)\
**Post date:** [25 November 2007 11:53 UTC](https://rubytalk.org/t/ann-ruby-oci8-1-0-0/42485/1 "2007-11-25T11:53:29Z")

</div>

ruby-oci8 1.0.0 is released. This is a Oracle module using OCI8 API.

&nbsp;&nbsp;[http://rubyforge.org/projects/ruby-oci8/](http://rubyforge.org/projects/ruby-oci8/)

This is second 1.0.0 release. I released 1.0.0 at 10:34:18 GMT.  
But I noticed that a bug (7 in the what's new list) was not fixed.  
I deleted it soon. But two people had downloaded. If you are the  
person, please download again. Sorry...

What's new.

1. fix a BUG when binding a Bignum. This bug was added in  
&nbsp;&nbsp;&nbsp;ruby-oci8 1.0.0-rc2. (reported by Daniel Berger)

2. add OCI8#describe\_table(table\_name), OCI8::Cursor#column\_metadata,  
&nbsp;&nbsp;&nbsp;OCI8::Metadata::Table, OCI8::Metadata::View and OCI8::Metadata::Column.

&nbsp;&nbsp;&nbsp;table information:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;con = OCI8.new('username/password')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table\_info = con.describe\_table('table\_name') #=\> OCI8::Metadata::Table  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;table\_info.columns #=\> an array of OCI8::Metadata::Column.

&nbsp;&nbsp;&nbsp;query information:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;con = OCI8.new('username/password')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr = con.exec('select \* from table\_name')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr.column\_metadata #=\> an array of OCI8::Metadata::Column.

5. add OCI8::BindType::BinaryDouble if [oci8lib.so](http://oci8lib.so) is compiled for  
&nbsp;&nbsp;&nbsp;Oracle 10g client. You can fetch exactly same values in Oracle.

&nbsp;&nbsp;&nbsp;You could fetch the values in previous version by adding the  
&nbsp;&nbsp;&nbsp;following line.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OCI8::BindType::Mapping[101] = OCI8::BindType::Float  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(This is default in ruby-oci8 1.0.0-rc2.)

&nbsp;&nbsp;&nbsp;But a fetched value may not be exactly same with the value in  
&nbsp;&nbsp;&nbsp;Oracle. That's because OCI8::BindType::Float's network  
&nbsp;&nbsp;&nbsp;representation is Oracle NUMBER data type. A BINARY\_DOUBLE  
&nbsp;&nbsp;&nbsp;value in Oracle become NUMBER on the network and is converted  
&nbsp;&nbsp;&nbsp;to Float on the client side. It makes a bit difference by  
&nbsp;&nbsp;&nbsp;round-off error.

&nbsp;&nbsp;&nbsp;In addition, Oracle NUMBER doesn't have NaN, +Infinity and -Infinity.  
&nbsp;&nbsp;&nbsp;You cannot fetch the values by older versions.

&nbsp;&nbsp;&nbsp;Note: When you bind a Float value, it is bound by  
&nbsp;&nbsp;&nbsp;OCI8::BindType::Float by default. You have two ways to bind  
&nbsp;&nbsp;&nbsp;it by OCI8::BindType::BinaryDouble.

&nbsp;&nbsp;&nbsp;a. bind explicitly.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;con = OCI8.new('ruby/oci8')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr = con.parse('insert into table\_name values (:1)')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr.bind\_param(1, 10.5, OCI8::SQLT\_IBDOUBLE)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr.exec

&nbsp;&nbsp;&nbsp;b. change the default behaviour if and only if you are sure that  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the Oracle client version and Oracle server version are both  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10g or upper.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# use OCI8::BindType::BinaryDouble for ruby's Float values.  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OCI8::BindType::Mapping[Float] = OCI8::BindType::BinaryDouble  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;con = OCI8.new('ruby/oci8')  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;csr = con.exec('insert into table\_name values (:1)', 10.5)

4. OCI8::Cursor#fetch\_hash accepts a block as a iterator.

5. [dbi] support external OS authentication.  
&nbsp;&nbsp;&nbsp;(contributed by Dan Fitch)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbh = DBI.connect('dbi:OCI8', nil, nil)

6. [dbi] add DatabaseHandle#columns and improve StatementHandle#column\_info  
&nbsp;&nbsp;&nbsp;(suggested by Venkat Pa)

7. [bug] fix a problem when binding ''(empty string) via dbi.
