[ruby-oci8-commit] [341] trunk/ruby-oci8: * lib/oci8/oci8.rb: move OCI8:: BindType module to bindtype.rb.

nobody at rubyforge.org nobody at rubyforge.org
Sat Apr 18 08:52:21 EDT 2009


Revision: 341
Author:   kubo
Date:     2009-04-18 08:52:21 -0400 (Sat, 18 Apr 2009)

Log Message:
-----------
* lib/oci8/oci8.rb: move OCI8::BindType module to bindtype.rb.
* lib/oci8/bindtype.rb: added. This defines OCI8::BindType.
* lib/oci8.rb.in: require 'oci8/bindtype.rb'

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/lib/oci8/oci8.rb
    trunk/ruby-oci8/lib/oci8.rb.in

Added Paths:
-----------
    trunk/ruby-oci8/lib/oci8/bindtype.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2009-04-17 11:49:37 UTC (rev 340)
+++ trunk/ruby-oci8/ChangeLog	2009-04-18 12:52:21 UTC (rev 341)
@@ -1,3 +1,8 @@
+2009-04-18  KUBO Takehiro  <kubo at jiubao.org>
+	* lib/oci8/oci8.rb: move OCI8::BindType module to bindtype.rb.
+	* lib/oci8/bindtype.rb: added. This defines OCI8::BindType.
+	* lib/oci8.rb.in: require 'oci8/bindtype.rb'
+
 2009-04-17  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/encoding.c, ext/oci8/lob.c, ext/oci8/metadata.c,
 	  ext/oci8/oci8.c: suppress "warning C4761: integral size mismatch

Added: trunk/ruby-oci8/lib/oci8/bindtype.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/bindtype.rb	                        (rev 0)
+++ trunk/ruby-oci8/lib/oci8/bindtype.rb	2009-04-18 12:52:21 UTC (rev 341)
@@ -0,0 +1,295 @@
+#--
+# bindtype.rb -- OCI8::BindType
+#
+# Copyright (C) 2009 KUBO Takehiro <kubo at jiubao.org>
+#++
+
+class OCI8
+  module BindType
+    Mapping = {}
+
+    class Base
+      def self.create(con, val, param, max_array_size)
+        self.new(con, val, param, max_array_size)
+      end
+    end
+
+    # get/set Date
+    class Date < OCI8::BindType::OraDate
+      def set(val)
+        super(val && ::OraDate.new(val.year, val.mon, val.mday))
+      end
+      def get()
+        (val = super()) && val.to_date
+      end
+    end
+
+    # get/set Number (for OCI8::SQLT_NUM)
+    class Number
+      def self.create(con, val, param, max_array_size)
+        if param.is_a? OCI8::Metadata::Base
+          precision = param.precision
+          scale = param.scale
+        end
+        if scale == -127
+          if precision == 0
+            # NUMBER declared without its scale and precision. (Oracle 9.2.0.3 or above)
+            klass = OCI8::BindType::Mapping[:number_no_prec_setting]
+          else
+            # FLOAT or FLOAT(p)
+            klass = OCI8::BindType::Float
+          end
+        elsif scale == 0
+          if precision == 0
+            # NUMBER whose scale and precision is unknown
+            # or
+            # NUMBER declared without its scale and precision. (Oracle 9.2.0.2 or below)
+            klass = OCI8::BindType::Mapping[:number_unknown_prec]
+          else
+            # NUMBER(p, 0)
+            klass = OCI8::BindType::Integer
+          end
+        else
+          # NUMBER(p, s)
+          if precision < 15 # the precision of double.
+            klass = OCI8::BindType::Float
+          else
+            # use BigDecimal instead?
+            klass = OCI8::BindType::OraNumber
+          end
+        end
+        klass.new(con, val, nil, max_array_size)
+      end
+    end
+
+    class String
+      # 1333 <= ceil(4000 / 3). 4000 is max size of char. 3 is NLS ratio of UTF-8.
+      @@minimum_bind_length = 1333
+
+      def self.minimum_bind_length
+        @@minimum_bind_length
+      end
+
+      def self.minimum_bind_length=(val)
+        @@minimum_bind_length = val
+      end
+
+      def self.create(con, val, param, max_array_size)
+        case param
+        when Hash
+          if param[:length]
+            # If length is passed explicitly, use it.
+            length = param[:length]
+          elsif val.is_a? String or (val.respond_to? :to_str and val = val.to_str)
+            if OCI8.respond_to? :encoding and OCI8.encoding != val.encoding
+              # If the string encoding is different with NLS_LANG character set,
+              # convert it to get the length.
+              val = val.encode(OCI8.encoding)
+            end
+            if val.respond_to? :bytesize
+              # ruby 1.8.7 or upper
+              length = val.bytesize
+            else
+              # ruby 1.8.6 or lower
+              length = val.size
+            end
+          end
+        when OCI8::Metadata::Base
+          case param.data_type
+          when :char, :varchar2
+            length = param.data_size
+            # character size may become large on character set conversion.
+            # The length of a Japanese half-width kana is one in Shift_JIS,
+            # two in EUC-JP, three in UTF-8.
+            length *= 3 unless param.char_used?
+          when :raw
+            # HEX needs twice space.
+            length = param.data_size * 2
+          end
+        end
+        length = @@minimum_bind_length if length.nil? or length < @@minimum_bind_length
+        self.new(con, val, length, max_array_size)
+      end
+    end
+
+    class RAW
+      def self.create(con, val, param, max_array_size)
+        case param
+        when Hash
+          length = 400 # default length
+          if param[:length]
+            length = param[:length]
+          elsif val.respond_to? :to_str and val.to_str.size > length
+            length = val.to_str.size
+          end
+        when OCI8::Metadata::Base
+          length = param.data_size
+        end
+        self.new(con, val, length, max_array_size)
+      end
+    end
+
+    class Long < OCI8::BindType::String
+      def self.create(con, val, param, max_array_size)
+        self.new(con, val, con.long_read_len, max_array_size)
+      end
+    end
+
+    class LongRaw < OCI8::BindType::RAW
+      def self.create(con, val, param, max_array_size)
+        self.new(con, val, con.long_read_len, max_array_size)
+      end
+    end
+
+    class CLOB
+      def self.create(con, val, param, max_array_size)
+        if param.is_a? OCI8::Metadata::Base and param.charset_form == :nchar
+          OCI8::BindType::NCLOB.new(con, val, nil, max_array_size)
+        else
+          OCI8::BindType::CLOB.new(con, val, nil, max_array_size)
+        end
+      end
+    end
+  end # BindType
+end
+
+# bind or explicitly define
+OCI8::BindType::Mapping[String]       = OCI8::BindType::String
+OCI8::BindType::Mapping[OraNumber]    = OCI8::BindType::OraNumber
+OCI8::BindType::Mapping[Fixnum]       = OCI8::BindType::Integer
+OCI8::BindType::Mapping[Float]        = OCI8::BindType::Float
+OCI8::BindType::Mapping[Integer]      = OCI8::BindType::Integer
+OCI8::BindType::Mapping[Bignum]       = OCI8::BindType::Integer
+OCI8::BindType::Mapping[OraDate]      = OCI8::BindType::OraDate
+OCI8::BindType::Mapping[Time]         = OCI8::BindType::Time
+OCI8::BindType::Mapping[Date]         = OCI8::BindType::Date
+OCI8::BindType::Mapping[DateTime]     = OCI8::BindType::DateTime
+OCI8::BindType::Mapping[OCI8::CLOB]   = OCI8::BindType::CLOB
+OCI8::BindType::Mapping[OCI8::NCLOB]  = OCI8::BindType::NCLOB
+OCI8::BindType::Mapping[OCI8::BLOB]   = OCI8::BindType::BLOB
+OCI8::BindType::Mapping[OCI8::BFILE]  = OCI8::BindType::BFILE
+OCI8::BindType::Mapping[OCI8::Cursor] = OCI8::BindType::Cursor
+
+# implicitly define
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# CHAR(1)       SQLT_AFC      1    0    0
+# CHAR(10)      SQLT_AFC     10    0    0
+OCI8::BindType::Mapping[:char] = OCI8::BindType::String
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# VARCHAR(1)    SQLT_CHR      1    0    0
+# VARCHAR(10)   SQLT_CHR     10    0    0
+# VARCHAR2(1)   SQLT_CHR      1    0    0
+# VARCHAR2(10)  SQLT_CHR     10    0    0
+OCI8::BindType::Mapping[:varchar2] = OCI8::BindType::String
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# RAW(1)        SQLT_BIN      1    0    0
+# RAW(10)       SQLT_BIN     10    0    0
+OCI8::BindType::Mapping[:raw] = OCI8::BindType::RAW
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# LONG          SQLT_LNG      0    0    0
+OCI8::BindType::Mapping[:long] = OCI8::BindType::Long
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# LONG RAW      SQLT_LBI      0    0    0
+OCI8::BindType::Mapping[:long_raw] = OCI8::BindType::LongRaw
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# CLOB          SQLT_CLOB  4000    0    0
+OCI8::BindType::Mapping[:clob] = OCI8::BindType::CLOB
+OCI8::BindType::Mapping[:nclob] = OCI8::BindType::NCLOB
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# BLOB          SQLT_BLOB  4000    0    0
+OCI8::BindType::Mapping[:blob] = OCI8::BindType::BLOB
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# BFILE         SQLT_BFILE 4000    0    0
+OCI8::BindType::Mapping[:bfile] = OCI8::BindType::BFILE
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# DATE          SQLT_DAT      7    0    0
+OCI8::BindType::Mapping[:date] = OCI8::BindType::Time
+
+if OCI8.oracle_client_version >= OCI8::ORAVER_9_0
+  OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time
+  OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time
+  OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time
+  OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM
+  OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS
+end
+
+# datatype        type     size prec scale
+# -------------------------------------------------
+# ROWID         SQLT_RDD      4    0    0
+OCI8::BindType::Mapping[:rowid] = OCI8::BindType::String
+
+# datatype           type     size prec scale
+# -----------------------------------------------------
+# FLOAT            SQLT_NUM     22  126 -127
+# FLOAT(1)         SQLT_NUM     22    1 -127
+# FLOAT(126)       SQLT_NUM     22  126 -127
+# DOUBLE PRECISION SQLT_NUM     22  126 -127
+# REAL             SQLT_NUM     22   63 -127
+# NUMBER           SQLT_NUM     22    0    0
+# NUMBER(1)        SQLT_NUM     22    1    0
+# NUMBER(38)       SQLT_NUM     22   38    0
+# NUMBER(1, 0)     SQLT_NUM     22    1    0
+# NUMBER(38, 0)    SQLT_NUM     22   38    0
+# NUMERIC          SQLT_NUM     22   38    0
+# INT              SQLT_NUM     22   38    0
+# INTEGER          SQLT_NUM     22   38    0
+# SMALLINT         SQLT_NUM     22   38    0
+OCI8::BindType::Mapping[:number] = OCI8::BindType::Number
+
+# mapping for calculated number values.
+#
+# for example:
+#   select col1 * 1.1 from tab1;
+#
+# For Oracle 9.2.0.2 or below, this is also used for NUMBER
+# datatypes that have no explicit setting of their precision
+# and scale.
+#
+# The default mapping is Float for ruby-oci8 1.0. It is OraNumber
+# for ruby-oci8 2.0.
+OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::OraNumber
+
+# mapping for number without precision and scale.
+#
+# for example:
+#   create table tab1 (col1 number);
+#   select col1 from tab1;
+#
+# note: This is available only on Oracle 9.2.0.3 or above.
+# see:  Oracle 9.2.0.x Patch Set Notes.
+#
+# The default mapping is Float for ruby-oci8 1.0. It is OraNumber
+# for ruby-oci8 2.0.
+OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::OraNumber
+
+if defined? OCI8::BindType::BinaryDouble
+  OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::BinaryDouble
+  OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::BinaryDouble
+else
+  OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::Float
+  OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::Float
+end
+
+# Cursor
+OCI8::BindType::Mapping[:cursor] = OCI8::BindType::Cursor
+
+# XMLType (This mapping will be changed before release.)
+OCI8::BindType::Mapping[:xmltype] = OCI8::BindType::Long

Modified: trunk/ruby-oci8/lib/oci8/oci8.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/oci8.rb	2009-04-17 11:49:37 UTC (rev 340)
+++ trunk/ruby-oci8/lib/oci8/oci8.rb	2009-04-18 12:52:21 UTC (rev 341)
@@ -1,5 +1,12 @@
-#   --*- ruby -*--
-# This is based on yoshidam's oracle.rb.
+#--
+# oci8.rb -- OCI8 and OCI8::Cursor
+#
+# Copyright (C) 2002-2009 KUBO Takehiro <kubo at jiubao.org>
+#
+# Original Copyright is:
+#   Oracle module for Ruby
+#   1998-2000 by yoshidam
+#++
 
 require 'date'
 
@@ -160,153 +167,6 @@
     @oracle_server_version
   end
 
-  module BindType
-    Mapping = {}
-
-    class Base
-      def self.create(con, val, param, max_array_size)
-        self.new(con, val, param, max_array_size)
-      end
-    end
-
-    # get/set Date
-    class Date < OCI8::BindType::OraDate
-      def set(val)
-        super(val && ::OraDate.new(val.year, val.mon, val.mday))
-      end
-      def get()
-        (val = super()) && val.to_date
-      end
-    end
-
-    # get/set Number (for OCI8::SQLT_NUM)
-    class Number
-      def self.create(con, val, param, max_array_size)
-        if param.is_a? OCI8::Metadata::Base
-          precision = param.precision
-          scale = param.scale
-        end
-        if scale == -127
-          if precision == 0
-            # NUMBER declared without its scale and precision. (Oracle 9.2.0.3 or above)
-            klass = OCI8::BindType::Mapping[:number_no_prec_setting]
-          else
-            # FLOAT or FLOAT(p)
-            klass = OCI8::BindType::Float
-          end
-        elsif scale == 0
-          if precision == 0
-            # NUMBER whose scale and precision is unknown
-            # or
-            # NUMBER declared without its scale and precision. (Oracle 9.2.0.2 or below)
-            klass = OCI8::BindType::Mapping[:number_unknown_prec]
-          else
-            # NUMBER(p, 0)
-            klass = OCI8::BindType::Integer
-          end
-        else
-          # NUMBER(p, s)
-          if precision < 15 # the precision of double.
-            klass = OCI8::BindType::Float
-          else
-            # use BigDecimal instead?
-            klass = OCI8::BindType::OraNumber
-          end
-        end
-        klass.new(con, val, nil, max_array_size)
-      end
-    end
-
-    class String
-      # 1333 <= ceil(4000 / 3). 4000 is max size of char. 3 is NLS ratio of UTF-8.
-      @@minimum_bind_length = 1333
-
-      def self.minimum_bind_length
-        @@minimum_bind_length
-      end
-
-      def self.minimum_bind_length=(val)
-        @@minimum_bind_length = val
-      end
-
-      def self.create(con, val, param, max_array_size)
-        case param
-        when Hash
-          if param[:length]
-            # If length is passed explicitly, use it.
-            length = param[:length]
-          elsif val.is_a? String or (val.respond_to? :to_str and val = val.to_str)
-            if OCI8.respond_to? :encoding and OCI8.encoding != val.encoding
-              # If the string encoding is different with NLS_LANG character set,
-              # convert it to get the length.
-              val = val.encode(OCI8.encoding)
-            end
-            if val.respond_to? :bytesize
-              # ruby 1.8.7 or upper
-              length = val.bytesize
-            else
-              # ruby 1.8.6 or lower
-              length = val.size
-            end
-          end
-        when OCI8::Metadata::Base
-          case param.data_type
-          when :char, :varchar2
-            length = param.data_size
-            # character size may become large on character set conversion.
-            # The length of a Japanese half-width kana is one in Shift_JIS,
-            # two in EUC-JP, three in UTF-8.
-            length *= 3 unless param.char_used?
-          when :raw
-            # HEX needs twice space.
-            length = param.data_size * 2
-          end
-        end
-        length = @@minimum_bind_length if length.nil? or length < @@minimum_bind_length
-        self.new(con, val, length, max_array_size)
-      end
-    end
-
-    class RAW
-      def self.create(con, val, param, max_array_size)
-        case param
-        when Hash
-          length = 400 # default length
-          if param[:length]
-            length = param[:length]
-          elsif val.respond_to? :to_str and val.to_str.size > length
-            length = val.to_str.size
-          end
-        when OCI8::Metadata::Base
-          length = param.data_size
-        end
-        self.new(con, val, length, max_array_size)
-      end
-    end
-
-    class Long < OCI8::BindType::String
-      def self.create(con, val, param, max_array_size)
-        self.new(con, val, con.long_read_len, max_array_size)
-      end
-    end
-
-    class LongRaw < OCI8::BindType::RAW
-      def self.create(con, val, param, max_array_size)
-        self.new(con, val, con.long_read_len, max_array_size)
-      end
-    end
-
-    class CLOB
-      def self.create(con, val, param, max_array_size)
-        if param.is_a? OCI8::Metadata::Base and param.charset_form == :nchar
-          OCI8::BindType::NCLOB.new(con, val, nil, max_array_size)
-        else
-          OCI8::BindType::CLOB.new(con, val, nil, max_array_size)
-        end
-      end
-    end
-  end # BindType
-
   # The instance of this class corresponds to cursor in the term of
   # Oracle, which corresponds to java.sql.Statement of JDBC and statement
   # handle $sth of Perl/DBI.
@@ -675,144 +535,3 @@
     OraNumber.new(self, format, nls_params)
   end
 end
-
-# bind or explicitly define
-OCI8::BindType::Mapping[String]       = OCI8::BindType::String
-OCI8::BindType::Mapping[OraNumber]    = OCI8::BindType::OraNumber
-OCI8::BindType::Mapping[Fixnum]       = OCI8::BindType::Integer
-OCI8::BindType::Mapping[Float]        = OCI8::BindType::Float
-OCI8::BindType::Mapping[Integer]      = OCI8::BindType::Integer
-OCI8::BindType::Mapping[Bignum]       = OCI8::BindType::Integer
-OCI8::BindType::Mapping[OraDate]      = OCI8::BindType::OraDate
-OCI8::BindType::Mapping[Time]         = OCI8::BindType::Time
-OCI8::BindType::Mapping[Date]         = OCI8::BindType::Date
-OCI8::BindType::Mapping[DateTime]     = OCI8::BindType::DateTime
-OCI8::BindType::Mapping[OCI8::CLOB]   = OCI8::BindType::CLOB
-OCI8::BindType::Mapping[OCI8::NCLOB]  = OCI8::BindType::NCLOB
-OCI8::BindType::Mapping[OCI8::BLOB]   = OCI8::BindType::BLOB
-OCI8::BindType::Mapping[OCI8::BFILE]  = OCI8::BindType::BFILE
-OCI8::BindType::Mapping[OCI8::Cursor] = OCI8::BindType::Cursor
-
-# implicitly define
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# CHAR(1)       SQLT_AFC      1    0    0
-# CHAR(10)      SQLT_AFC     10    0    0
-OCI8::BindType::Mapping[:char] = OCI8::BindType::String
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# VARCHAR(1)    SQLT_CHR      1    0    0
-# VARCHAR(10)   SQLT_CHR     10    0    0
-# VARCHAR2(1)   SQLT_CHR      1    0    0
-# VARCHAR2(10)  SQLT_CHR     10    0    0
-OCI8::BindType::Mapping[:varchar2] = OCI8::BindType::String
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# RAW(1)        SQLT_BIN      1    0    0
-# RAW(10)       SQLT_BIN     10    0    0
-OCI8::BindType::Mapping[:raw] = OCI8::BindType::RAW
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# LONG          SQLT_LNG      0    0    0
-OCI8::BindType::Mapping[:long] = OCI8::BindType::Long
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# LONG RAW      SQLT_LBI      0    0    0
-OCI8::BindType::Mapping[:long_raw] = OCI8::BindType::LongRaw
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# CLOB          SQLT_CLOB  4000    0    0
-OCI8::BindType::Mapping[:clob] = OCI8::BindType::CLOB
-OCI8::BindType::Mapping[:nclob] = OCI8::BindType::NCLOB
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# BLOB          SQLT_BLOB  4000    0    0
-OCI8::BindType::Mapping[:blob] = OCI8::BindType::BLOB
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# BFILE         SQLT_BFILE 4000    0    0
-OCI8::BindType::Mapping[:bfile] = OCI8::BindType::BFILE
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# DATE          SQLT_DAT      7    0    0
-OCI8::BindType::Mapping[:date] = OCI8::BindType::Time
-
-if OCI8.oracle_client_version >= OCI8::ORAVER_9_0
-  OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time
-  OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time
-  OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time
-  OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM
-  OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS
-end
-
-# datatype        type     size prec scale
-# -------------------------------------------------
-# ROWID         SQLT_RDD      4    0    0
-OCI8::BindType::Mapping[:rowid] = OCI8::BindType::String
-
-# datatype           type     size prec scale
-# -----------------------------------------------------
-# FLOAT            SQLT_NUM     22  126 -127
-# FLOAT(1)         SQLT_NUM     22    1 -127
-# FLOAT(126)       SQLT_NUM     22  126 -127
-# DOUBLE PRECISION SQLT_NUM     22  126 -127
-# REAL             SQLT_NUM     22   63 -127
-# NUMBER           SQLT_NUM     22    0    0
-# NUMBER(1)        SQLT_NUM     22    1    0
-# NUMBER(38)       SQLT_NUM     22   38    0
-# NUMBER(1, 0)     SQLT_NUM     22    1    0
-# NUMBER(38, 0)    SQLT_NUM     22   38    0
-# NUMERIC          SQLT_NUM     22   38    0
-# INT              SQLT_NUM     22   38    0
-# INTEGER          SQLT_NUM     22   38    0
-# SMALLINT         SQLT_NUM     22   38    0
-OCI8::BindType::Mapping[:number] = OCI8::BindType::Number
-
-# mapping for calculated number values.
-#
-# for example:
-#   select col1 * 1.1 from tab1;
-#
-# For Oracle 9.2.0.2 or below, this is also used for NUMBER
-# datatypes that have no explicit setting of their precision
-# and scale.
-#
-# The default mapping is Float for ruby-oci8 1.0. It is OraNumber
-# for ruby-oci8 2.0.
-OCI8::BindType::Mapping[:number_unknown_prec] = OCI8::BindType::OraNumber
-
-# mapping for number without precision and scale.
-#
-# for example:
-#   create table tab1 (col1 number);
-#   select col1 from tab1;
-#
-# note: This is available only on Oracle 9.2.0.3 or above.
-# see:  Oracle 9.2.0.x Patch Set Notes.
-#
-# The default mapping is Float for ruby-oci8 1.0. It is OraNumber
-# for ruby-oci8 2.0.
-OCI8::BindType::Mapping[:number_no_prec_setting] = OCI8::BindType::OraNumber
-
-if defined? OCI8::BindType::BinaryDouble
-  OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::BinaryDouble
-  OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::BinaryDouble
-else
-  OCI8::BindType::Mapping[:binary_float] = OCI8::BindType::Float
-  OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::Float
-end
-
-# Cursor
-OCI8::BindType::Mapping[:cursor] = OCI8::BindType::Cursor
-
-# XMLType (This mapping will be changed before release.)
-OCI8::BindType::Mapping[:xmltype] = OCI8::BindType::Long

Modified: trunk/ruby-oci8/lib/oci8.rb.in
===================================================================
--- trunk/ruby-oci8/lib/oci8.rb.in	2009-04-17 11:49:37 UTC (rev 340)
+++ trunk/ruby-oci8/lib/oci8.rb.in	2009-04-18 12:52:21 UTC (rev 341)
@@ -71,6 +71,7 @@
 
 require 'oci8/datetime.rb'
 require 'oci8/oci8.rb'
+require 'oci8/bindtype.rb'
 require 'oci8/metadata.rb'
 require 'oci8/compat.rb'
 require 'oci8/object.rb'




More information about the ruby-oci8-commit mailing list