[ruby-oci8-commit] [304] trunk/ruby-oci8: * custom-rdoc.rb: fix for rdoc bundled with ruby 1.9 .

nobody at rubyforge.org nobody at rubyforge.org
Sat Jan 3 03:36:03 EST 2009


Revision: 304
Author:   kubo
Date:     2009-01-03 03:36:03 -0500 (Sat, 03 Jan 2009)

Log Message:
-----------
* custom-rdoc.rb: fix for rdoc bundled with ruby 1.9.
* ext/oci8/apiwrap.yml, ext/oci8/oci8lib.c: set the value of
    OCI8.oracle_client_version by OCIClientVersion() if
    the binary is configured with --with-runtime-check and
    the Oracle client is 10.2 or upper.
* test/test_oranumber.rb: disable workaround code when
    the Oracle client is 10.2.0.4 or upper.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/custom-rdoc.rb
    trunk/ruby-oci8/ext/oci8/apiwrap.yml
    trunk/ruby-oci8/ext/oci8/oci8lib.c
    trunk/ruby-oci8/test/test_oranumber.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2008-12-30 13:39:05 UTC (rev 303)
+++ trunk/ruby-oci8/ChangeLog	2009-01-03 08:36:03 UTC (rev 304)
@@ -1,3 +1,12 @@
+2009-01-03  KUBO Takehiro  <kubo at jiubao.org>
+	* custom-rdoc.rb: fix for rdoc bundled with ruby 1.9.
+	* ext/oci8/apiwrap.yml, ext/oci8/oci8lib.c: set the value of
+	    OCI8.oracle_client_version by OCIClientVersion() if
+	    the binary is configured with --with-runtime-check and
+	    the Oracle client is 10.2 or upper.
+	* test/test_oranumber.rb: disable workaround code when
+	    the Oracle client is 10.2.0.4 or upper.
+
 2008-12-30  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/attr.c: rewrite code converting the rowid descriptor
 	    to string representation by using oci8_exec_sql().

Modified: trunk/ruby-oci8/custom-rdoc.rb
===================================================================
--- trunk/ruby-oci8/custom-rdoc.rb	2008-12-30 13:39:05 UTC (rev 303)
+++ trunk/ruby-oci8/custom-rdoc.rb	2009-01-03 08:36:03 UTC (rev 304)
@@ -1,33 +1,39 @@
 require 'rdoc/rdoc'
 
-module RDoc
-  class C_Parser
-    alias :do_classes_orig :do_classes
-    def do_classes
-      # oci8_cOCIHandle = rb_define_class("OCIHandle", rb_cObject)
-      handle_class_module('oci8_cOCIHandle', 'class', 'OCIHandle', 'rb_cObject', nil)
-      # cOCI8 = rb_define_class("OCI8", oci8_cOCIHandle)
-      handle_class_module('cOCI8', 'class', 'OCI8', 'oci8_cOCIHandle', nil)
-      # mOCI8BindType = rb_define_module_under(cOCI8, "BindType");
-      handle_class_module('mOCI8BindType', 'module', 'BindType', nil, 'cOCI8')
-      # cOCI8BindTypeBase = rb_define_class_under(mOCI8BindType, "Base", oci8_cOCIHandle);
-      handle_class_module('cOCI8BindTypeBase', 'class', 'Base', nil, 'mOCI8BindType')
+if defined? RDoc::Parser::C
+  c_parser = RDoc::Parser::C
+elsif defined? RDoc::C_Parser
+  c_parser = RDoc::C_Parser
+end
 
-      # var_name = oci8_define_class_under(in_module, "class_name", &xxxx);
-      @body.scan(/(\w+)\s*=\s*oci8_define_class_under\s*\(\s*(\w+)\s*,\s*"(\w+)",\s*&\w+?\s*\)/) do
-        |var_name, in_module, class_name|
-        handle_class_module(var_name, "class", class_name, 'oci8_cOCIHandle', in_module)
-      end
+c_parser.module_eval do
+  alias :do_classes_orig :do_classes
+  def do_classes
+    content = (defined? @content) && @content || @body
 
-      # var_name = oci8_define_bind_class("class_name", &xxxx);
-      @body.scan(/(?:(\w+)\s*=\s*)?oci8_define_bind_class\s*\(\s*"(\w+)",\s*&\w+?\s*\)/) do
-        |var_name, class_name|
-        var_name ||= 'dummy'
-        handle_class_module(var_name, "class", class_name, 'cOCI8BindTypeBase', 'mOCI8BindType')
-      end
+    # oci8_cOCIHandle = rb_define_class("OCIHandle", rb_cObject)
+    handle_class_module('oci8_cOCIHandle', 'class', 'OCIHandle', 'rb_cObject', nil)
+    # cOCI8 = rb_define_class("OCI8", oci8_cOCIHandle)
+    handle_class_module('cOCI8', 'class', 'OCI8', 'oci8_cOCIHandle', nil)
+    # mOCI8BindType = rb_define_module_under(cOCI8, "BindType");
+    handle_class_module('mOCI8BindType', 'module', 'BindType', nil, 'cOCI8')
+    # cOCI8BindTypeBase = rb_define_class_under(mOCI8BindType, "Base", oci8_cOCIHandle);
+    handle_class_module('cOCI8BindTypeBase', 'class', 'Base', nil, 'mOCI8BindType')
 
-      do_classes_orig
+    # var_name = oci8_define_class_under(in_module, "class_name", &xxxx);
+    content.scan(/(\w+)\s*=\s*oci8_define_class_under\s*\(\s*(\w+)\s*,\s*"(\w+)",\s*&\w+?\s*\)/) do
+      |var_name, in_module, class_name|
+      handle_class_module(var_name, "class", class_name, 'oci8_cOCIHandle', in_module)
     end
+
+    # var_name = oci8_define_bind_class("class_name", &xxxx);
+    content.scan(/(?:(\w+)\s*=\s*)?oci8_define_bind_class\s*\(\s*"(\w+)",\s*&\w+?\s*\)/) do
+      |var_name, class_name|
+      var_name ||= 'dummy'
+      handle_class_module(var_name, "class", class_name, 'cOCI8BindTypeBase', 'mOCI8BindType')
+    end
+
+    do_classes_orig
   end
 end
 

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.yml	2008-12-30 13:39:05 UTC (rev 303)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.yml	2009-01-03 08:36:03 UTC (rev 304)
@@ -1190,6 +1190,16 @@
 # Oracle 10.2
 #
 
+# round trip: 0
+OCIClientVersion:
+  :version: 1020
+  :ret:     void
+  :args:    - sword *major_version
+            - sword *minor_version
+            - sword *update_num
+            - sword *patch_num
+            - sword *port_update_num
+
 # round trip: 1
 OCIDBStartup_nb:
   :version: 1020

Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8lib.c	2008-12-30 13:39:05 UTC (rev 303)
+++ trunk/ruby-oci8/ext/oci8/oci8lib.c	2009-01-03 08:36:03 UTC (rev 304)
@@ -111,6 +111,11 @@
 
 #ifdef RUNTIME_API_CHECK
     Init_oci8_apiwrap();
+    if (have_OCIClientVersion) {
+        sword major, minor, update, patch, port_update;
+        OCIClientVersion(&major, &minor, &update, &patch, &port_update);
+        oracle_client_version = (major << 24) | (minor << 20) | (update << 12) | (patch << 8) | port_update;
+    }
 #endif
 
     id_oci8_class = rb_intern("__oci8_class__");

Modified: trunk/ruby-oci8/test/test_oranumber.rb
===================================================================
--- trunk/ruby-oci8/test/test_oranumber.rb	2008-12-30 13:39:05 UTC (rev 303)
+++ trunk/ruby-oci8/test/test_oranumber.rb	2009-01-03 08:36:03 UTC (rev 304)
@@ -98,9 +98,12 @@
           puts '-----------'
           raise $!
         end
-        # explicity convert actual_val to a Float to prevent SEGV
-        # in OCINumberSub().
-        actual_val = actual_val.to_f if defined? ::MiniTest
+        # explicity convert actual_val to a Float to prevent
+        # SEGV in OCINumberSub() if the Oracle client vesion
+        # is less than 10.2.0.4.
+        if defined? ::MiniTest and OCI8.oracle_client_version < 0x0a200400
+          actual_val = actual_val.to_f
+        end
         assert_in_delta(expected_val, actual_val, delta, x)
       end
     end




More information about the ruby-oci8-commit mailing list