[ruby-oci8-commit] [469] trunk/ruby-oci8: fix some issues on compilation.

nobody at rubyforge.org nobody at rubyforge.org
Fri Dec 2 22:47:59 EST 2011


Revision: 469
Author:   kubo
Date:     2011-12-02 22:47:59 -0500 (Fri, 02 Dec 2011)

Log Message:
-----------
fix some issues on compilation.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/apiwrap.yml
    trunk/ruby-oci8/ext/oci8/oraconf.rb
    trunk/ruby-oci8/lib/oci8/connection_pool.rb
    trunk/ruby-oci8/lib/oci8/properties.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2011-11-27 06:23:24 UTC (rev 468)
+++ trunk/ruby-oci8/ChangeLog	2011-12-03 03:47:59 UTC (rev 469)
@@ -1,3 +1,10 @@
+2011-12-03  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/apiwrap.yml: fix for run-time Oracle function checking.
+	* ext/oci8/oraconf.rb: fix a bug not to compile for full client on
+	    Windows. The bug was caused by the commit at 2011-10-17.
+	* lib/oci8/connection_pool.rb, lib/oci8/properties.rb: fix rdoc
+	    comments.
+
 2011-11-27  KUBO Takehiro  <kubo at jiubao.org>
 	* test/test_break.rb: fix test_timeout test for an Oracle server
 	    on Windows.

Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml
===================================================================
--- trunk/ruby-oci8/ext/oci8/apiwrap.yml	2011-11-27 06:23:24 UTC (rev 468)
+++ trunk/ruby-oci8/ext/oci8/apiwrap.yml	2011-12-03 03:47:59 UTC (rev 469)
@@ -373,7 +373,7 @@
             - ub1 csfrm
 
 # round trip: 1
-OCILogoff_nb:
+OCILogoff:
   :version: 800
   :args:
             - OCISvcCtx *svchp
@@ -817,7 +817,7 @@
             - CONST OCIRaw *raw
 
 # round trip: 1
-OCISessionEnd_nb:
+OCISessionEnd:
   :version: 800
   :args:
             - OCISvcCtx *svchp
@@ -836,7 +836,7 @@
             - ub4 mode
 
 # round trip: 1
-OCIServerDetach_nb:
+OCIServerDetach:
   :version: 800
   :args:
             - OCIServer *srvhp
@@ -945,6 +945,14 @@
             - ub4 flags
 
 # round trip: 1
+OCITransRollback:
+  :version: 800
+  :args:
+            - OCISvcCtx *svchp
+            - OCIError *errhp
+            - ub4 flags
+
+# round trip: 1
 OCITransRollback_nb:
   :version: 800
   :args:

Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/oraconf.rb	2011-11-27 06:23:24 UTC (rev 468)
+++ trunk/ruby-oci8/ext/oci8/oraconf.rb	2011-12-03 03:47:59 UTC (rev 469)
@@ -641,12 +641,12 @@
 
   if RUBY_PLATFORM =~ /mswin32|cygwin|mingw32|bccwin32/ # when Windows
 
-    def get_libs(base_dir = oci_base_dir)
+    def get_libs(lib_dir)
       case RUBY_PLATFORM
       when /cygwin/
         open("OCI.def", "w") do |f|
           f.puts("EXPORTS")
-          open("|nm #{base_dir}/LIB/MSVC/OCI.LIB") do |r|
+          open("|nm #{lib_dir}/MSVC/OCI.LIB") do |r|
             while line = r.gets
               f.puts($') if line =~ / T _/
             end
@@ -661,21 +661,21 @@
       when /bccwin32/
         # replace '/' to '\\' because bcc linker misunderstands
         # 'C:/foo/bar/OCI.LIB' as unknown option.
-        lib = "#{base_dir}/LIB/BORLAND/OCI.LIB"
+        lib = "#{lib_dir}/BORLAND/OCI.LIB"
         return lib.tr('/', '\\') if File.exist?(lib)
         raise <<EOS
 #{lib} does not exist.
 
 Your Oracle may not support Borland C++.
 If you want to run this module, run the following command at your own risk.
-  cd #{base_dir.tr('/', '\\')}\\LIB
+  cd #{lib_dir.tr('/', '\\')}
   mkdir Borland
   cd Borland
   coff2omf ..\\MSVC\\OCI.LIB OCI.LIB
 EOS
         exit 1
       else
-        "\"#{base_dir}/LIB/MSVC/OCI.LIB\""
+        "\"#{lib_dir}/MSVC/OCI.LIB\""
       end
     end
 
@@ -702,7 +702,7 @@
 
     @oracle_home = get_home()
     if RUBY_PLATFORM =~ /freebsd/ && @oracle_home == '/usr/local/oracle8-client'
-      @version = '817'
+      raise "Oralce 8i is not supported."
     else
       @version = get_version()
     end
@@ -717,7 +717,9 @@
       use_lib32 = false
     end
 
-    if use_lib32
+    if RUBY_PLATFORM =~ /mswin32|cygwin|mingw32|bccwin32/
+      lib_dir = "#{@oracle_home}/oci/lib"
+    elsif use_lib32
       lib_dir = "#{@oracle_home}/lib32"
     else
       lib_dir = "#{@oracle_home}/lib"
@@ -840,23 +842,14 @@
       oracle_home.gsub(/\\/, '/')
     end
 
-    def oci_base_dir
-      case @version
-      when /80./
-        "#{@oracle_home}/OCI80"
-      else
-        "#{@oracle_home}/OCI"
-      end
-    end
-
     def get_cflags
-      unless File.exist?("#{oci_base_dir}/INCLUDE/OCI.H")
-        raise "'#{oci_base_dir}/INCLUDE/OCI.H' does not exists. Please install 'Oracle Call Interface'."
+      unless File.exist?("#{@oracle_home}/OCI/INCLUDE/OCI.H")
+        raise "'#{@oracle_home}/OCI/INCLUDE/OCI.H' does not exists. Please install 'Oracle Call Interface'."
       end
       if RUBY_PLATFORM =~ /cygwin/
-        " \"-I#{oci_base_dir}/INCLUDE\" -D_int64=\"long long\""
+        " \"-I#{@oracle_home}/OCI/INCLUDE\" -D_int64=\"long long\""
       else
-        " \"-I#{oci_base_dir}/INCLUDE\""
+        " \"-I#{@oracle_home}/OCI/INCLUDE\""
       end
     end
 
@@ -978,7 +971,7 @@
       end
       @cflags = " \"-I#{inc_dir}\""
       @cflags += " -D_int64=\"long long\"" if RUBY_PLATFORM =~ /cygwin/
-      @libs = get_libs("#{ic_dir}/sdk")
+      @libs = get_libs("#{ic_dir}/sdk/lib")
       ld_path = nil
     else
       @cflags = " -I#{inc_dir}"

Modified: trunk/ruby-oci8/lib/oci8/connection_pool.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/connection_pool.rb	2011-11-27 06:23:24 UTC (rev 468)
+++ trunk/ruby-oci8/lib/oci8/connection_pool.rb	2011-12-03 03:47:59 UTC (rev 469)
@@ -5,6 +5,25 @@
 #++
 
 class OCI8
+
+  # Connection pooling is the use of a group (the pool) of reusable
+  # physical connections by several sessions to balance loads.
+  # See: {Oracle Call Interface Manual}[http://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci09adv.htm#sthref1479]
+  #
+  # This is equivalent to Oracle JDBC Driver {OCI Connection Pooling}[http://docs.oracle.com/cd/E11882_01/java.112/e16548/ociconpl.htm#JJDBC28789].
+  #
+  # Usage:
+  #   # Create a connection pool.
+  #   # username and password are required to establish an implicit primary session.
+  #   cpool = OCI8::ConnectionPool.new(1, 5, 2, username, password, database)
+  #   
+  #   # Get a session from the pool.
+  #   # Pass the connection pool to the third argument.
+  #   conn1 = OCI8.new(username, password, cpool)
+  #   
+  #   # Get another session.
+  #   conn2 = OCI8.new(username, password, cpool)
+  #
   class ConnectionPool
 
     # call-seq:
@@ -54,7 +73,7 @@
     # call-seq:
     #   busy_count -> integer
     #
-    # Returns the number of busy connections.
+    # Returns the number of busy physical connections.
     def busy_count
       attr_get_ub4(OCI_ATTR_CONN_BUSY_COUNT)
     end
@@ -62,7 +81,7 @@
     # call-seq:
     #   open_count -> integer
     #
-    # Returns the number of open connections.
+    # Returns the number of open physical connections.
     def open_count
       attr_get_ub4(OCI_ATTR_CONN_OPEN_COUNT)
     end
@@ -70,7 +89,7 @@
     # call-seq:
     #   min -> integer
     #
-    # Returns the number of minimum connections.
+    # Returns the number of minimum physical connections.
     def min
       attr_get_ub4(OCI_ATTR_CONN_MIN)
     end
@@ -78,7 +97,7 @@
     # call-seq:
     #   max -> integer
     #
-    # Returns the number of maximum connections.
+    # Returns the number of maximum physical connections.
     def max
       attr_get_ub4(OCI_ATTR_CONN_MAX)
     end

Modified: trunk/ruby-oci8/lib/oci8/properties.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/properties.rb	2011-11-27 06:23:24 UTC (rev 468)
+++ trunk/ruby-oci8/lib/oci8/properties.rb	2011-12-03 03:47:59 UTC (rev 469)
@@ -51,6 +51,7 @@
   # Supported properties are listed below:
   #
   # [:length_semantics]
+  #     (new in 2.1.0)
   #     +:char+ when Oracle character length is counted by the number of characters.
   #     +:byte+ when it is counted by the number of bytes.
   #     The default setting is +:byte+ because +:char+ causes unexpected behaviour on




More information about the ruby-oci8-commit mailing list