[ruby-oci8-commit] [471] trunk/ruby-oci8: Check object type availability by querying all_objects data dictionary.

nobody at rubyforge.org nobody at rubyforge.org
Sat Dec 3 00:16:14 EST 2011


Revision: 471
Author:   kubo
Date:     2011-12-03 00:16:13 -0500 (Sat, 03 Dec 2011)

Log Message:
-----------
Check object type availability by querying all_objects data dictionary.
Fix #3 at http://github.com/kubo/ruby-oci8.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/test/test_metadata.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-12-03 04:33:32 UTC (rev 470)
+++ trunk/ruby-oci8/ChangeLog	2011-12-03 05:16:13 UTC (rev 471)
@@ -1,4 +1,8 @@
 2011-12-03  KUBO Takehiro  <kubo at jiubao.org>
+	* test/test_metadata.rb: Check object type availability by querying
+	    all_objects data dictionary. Fix #3 at http://github.com/kubo/ruby-oci8.
+
+2011-12-03  KUBO Takehiro  <kubo at jiubao.org>
 	* ruby-oci8.gemspec: Use Gem::Command.build_args to get arguments
 	    after '--'. This may solve issues #4 at http://github.com/kubo/ruby-oci8.
 

Modified: trunk/ruby-oci8/test/test_metadata.rb
===================================================================
--- trunk/ruby-oci8/test/test_metadata.rb	2011-12-03 04:33:32 UTC (rev 470)
+++ trunk/ruby-oci8/test/test_metadata.rb	2011-12-03 05:16:13 UTC (rev 471)
@@ -59,8 +59,18 @@
       @table = hash
     end
 
-    def oraver
-      @table[:oraver]
+    def available?(conn)
+      return false if $oracle_version < @table[:oraver]
+      if /^(\w+)\.(\w+)$/ =~ @table[:data_type_string]
+        if conn.select_one('select 1 from all_objects where owner = :1 and object_name = :2', $1, $2)
+          true
+        else
+          warn "skip a test for unsupported datatype: #{@table[:data_type_string]}."
+          false
+        end
+      else
+        true
+      end
     end
   end
 
@@ -1360,7 +1370,7 @@
     end
 
     coldef = @@column_test_data.find_all do |c|
-      $oracle_version >= c.oraver
+      c.available?(@conn)
     end
 
     drop_table('test_table')




More information about the ruby-oci8-commit mailing list