[ruby-oci8-commit] [330] trunk/ruby-oci8: * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ oraconf.rb:

nobody at rubyforge.org nobody at rubyforge.org
Tue Mar 24 11:08:38 EDT 2009


Revision: 330
Author:   kubo
Date:     2009-03-24 11:08:37 -0400 (Tue, 24 Mar 2009)

Log Message:
-----------
* ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/oraconf.rb:
    fix a problem when compiling with Oracle 8.0.
    (reported by Axel Reinhold)

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/oci8.h
    trunk/ruby-oci8/ext/oci8/oraconf.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2009-03-24 01:37:43 UTC (rev 329)
+++ trunk/ruby-oci8/ChangeLog	2009-03-24 15:08:37 UTC (rev 330)
@@ -1,6 +1,12 @@
 2009-03-24  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/oraconf.rb:
+	    fix a problem when compiling with Oracle 8.0.
+	    (reported by Axel Reinhold)
+
+2009-03-24  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/extconf.rb, ext/oci8/oci8.h: fix a problem when
 	    compiling with Oracle 9.2.
+	    (reported by Axel Reinhold)
 	* ext/oci8/apiwrap.yml: suppres warnings 'discards qualifiers
 	    from pointer target type' when compiling with Oracle 8i.
 

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2009-03-24 01:37:43 UTC (rev 329)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2009-03-24 15:08:37 UTC (rev 330)
@@ -61,10 +61,13 @@
   puts "checking for Oracle #{verstr} API - #{result}"
   break if result == 'fail'
 end
-$defs << "-DACTUAL_ORACLE_CLIENT_VERSION=#{format('0x%08x', oci_actual_client_version)}"
 
+have_type('oratext', 'ociap.h')
+have_type('OCIDateTime*', 'ociap.h')
+have_type('OCIInterval*', 'ociap.h')
 have_type('OCICallbackLobRead2', 'ociap.h')
 have_type('OCICallbackLobWrite2', 'ociap.h')
+have_type('OCIAdmin*', 'ociap.h')
 
 if with_config('oracle-version')
   oci_client_version = with_config('oracle-version').to_i

Modified: trunk/ruby-oci8/ext/oci8/oci8.h
===================================================================
--- trunk/ruby-oci8/ext/oci8/oci8.h	2009-03-24 01:37:43 UTC (rev 329)
+++ trunk/ruby-oci8/ext/oci8/oci8.h	2009-03-24 15:08:37 UTC (rev 330)
@@ -49,9 +49,12 @@
 #include <ruby/encoding.h>
 #endif
 
-#if ACTUAL_ORACLE_CLIENT_VERSION < ORAVER_10_2
-typedef struct OCIAdmin OCIAdmin;
+#ifndef OCI_TEMP_CLOB
+#define OCI_TEMP_CLOB 1
 #endif
+#ifndef OCI_TEMP_BLOB
+#define OCI_TEMP_BLOB 2
+#endif
 
 #ifndef ORAXB8_DEFINED
 #if SIZEOF_LONG == 8
@@ -66,6 +69,15 @@
 #endif
 #endif /* ORAXB8_DEFINED */
 
+#ifndef HAVE_TYPE_ORATEXT
+typedef unsigned char oratext;
+#endif
+#ifndef HAVE_TYPE_OCIDATETIME_
+typedef struct OCIDateTime OCIDateTime;
+#endif
+#ifndef HAVE_TYPE_OCIINTERVAL_
+typedef struct OCIInterval OCIInterval;
+#endif
 #ifndef HAVE_TYPE_OCICALLBACKLOBREAD2
 typedef sb4 (*OCICallbackLobRead2)(dvoid *ctxp, CONST dvoid *bufp, oraub8 len,
                                    ub1 piece, dvoid **changed_bufpp,
@@ -76,6 +88,9 @@
                                     ub1 *piece, dvoid **changed_bufpp,
                                     oraub8 *changed_lenp);
 #endif
+#ifndef HAVE_TYPE_OCIADMIN_
+typedef struct OCIAdmin OCIAdmin;
+#endif
 
 /* new macros in ruby 1.8.6.
  * define compatible macros for ruby 1.8.5 or lower.

Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/oraconf.rb	2009-03-24 01:37:43 UTC (rev 329)
+++ trunk/ruby-oci8/ext/oci8/oraconf.rb	2009-03-24 15:08:37 UTC (rev 330)
@@ -945,21 +945,18 @@
         end
       end
 
-      # remove object files from libs.
-      objs = []
-      libs.gsub!(/\S+\.o\b/) do |obj|
-        objs << obj
-        ""
-      end
-      # change object files to an archive file to work around.
-      if objs.length > 0
-        Logging::open do
-          puts "change object files to an archive file."
-          command = Config::CONFIG["AR"] + " cru oracle_objs.a " + objs.join(" ")
-          puts command
-          system(command)
-          libs = "oracle_objs.a " + libs
+      # check whether object files are included.
+      if /\S+\.o\b/ =~ libs
+
+        # monkey patching!
+        Object.module_eval do
+          alias :orig_link_command :link_command
+          def link_command(ldflags, opt="", libpath=$DEFLIBPATH|$LIBPATH)
+            opt = "" if opt == $libs
+            orig_link_command(ldflags, opt, libpath)
+          end
         end
+
       end
       libs
     end # get_libs




More information about the ruby-oci8-commit mailing list