[ruby-oci8-commit] [350] trunk/ruby-oci8: * ext/oci8/bind.c: delete OCI8::BindType::Fixnum.

nobody at rubyforge.org nobody at rubyforge.org
Tue May 19 08:51:29 EDT 2009


Revision: 350
Author:   kubo
Date:     2009-05-19 08:51:28 -0400 (Tue, 19 May 2009)

Log Message:
-----------
* ext/oci8/bind.c: delete OCI8::BindType::Fixnum.
* lib/oci8/compat.rb: add OCI8::BindType::Fixnum as an alias
    of OCI8::BindType::Integer.
* ext/oci8/extconf.rb: change extconf.rb's argument value of
    '--with-oracle-version' to accept dotted version such as
    '9.2.0.'
* ext/oci8/oraconf.rb: When extconf.rb fails and it is run
    by sudo command, change the error message to notice that
    'sudo' may unset environment variables.

Modified Paths:
--------------
    trunk/ruby-oci8/ChangeLog
    trunk/ruby-oci8/ext/oci8/bind.c
    trunk/ruby-oci8/ext/oci8/extconf.rb
    trunk/ruby-oci8/ext/oci8/oraconf.rb
    trunk/ruby-oci8/lib/oci8/compat.rb

Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog	2009-05-18 16:49:30 UTC (rev 349)
+++ trunk/ruby-oci8/ChangeLog	2009-05-19 12:51:28 UTC (rev 350)
@@ -1,3 +1,14 @@
+2009-05-19  KUBO Takehiro  <kubo at jiubao.org>
+	* ext/oci8/bind.c: delete OCI8::BindType::Fixnum.
+	* lib/oci8/compat.rb: add OCI8::BindType::Fixnum as an alias
+	    of OCI8::BindType::Integer.
+	* ext/oci8/extconf.rb: change extconf.rb's argument value of
+	    '--with-oracle-version' to accept dotted version such as
+	    '9.2.0.'
+	* ext/oci8/oraconf.rb: When extconf.rb fails and it is run
+	    by sudo command, change the error message to notice that
+	    'sudo' may unset environment variables.
+
 2009-05-18  KUBO Takehiro  <kubo at jiubao.org>
 	* ext/oci8/oci8.c: revise rdoc comments for OCI8#ping and
 	    OCI8#client_identifier=. Add OCI8#module=, OCI8#action= and

Modified: trunk/ruby-oci8/ext/oci8/bind.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/bind.c	2009-05-18 16:49:30 UTC (rev 349)
+++ trunk/ruby-oci8/ext/oci8/bind.c	2009-05-19 12:51:28 UTC (rev 350)
@@ -239,42 +239,6 @@
 #endif /* USE_DYNAMIC_FETCH */
 
 /*
- * bind_fixnum
- */
-static VALUE bind_fixnum_get(oci8_bind_t *obind, void *data, void *null_struct)
-{
-    return LONG2NUM(*(long*)data);
-}
-
-static void bind_fixnum_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val)
-{
-    Check_Type(val, T_FIXNUM);
-    *(long*)data = FIX2LONG(val);
-}
-
-static void bind_fixnum_init(oci8_bind_t *obind, VALUE svc, VALUE val, VALUE length)
-{
-    obind->value_sz = sizeof(long);
-    obind->alloc_sz = sizeof(long);
-}
-
-static const oci8_bind_class_t bind_fixnum_class = {
-    {
-        NULL,
-        oci8_bind_free,
-        sizeof(oci8_bind_t)
-    },
-    bind_fixnum_get,
-    bind_fixnum_set,
-    bind_fixnum_init,
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    SQLT_INT
-};
-
-/*
  * bind_float
  */
 static VALUE bind_float_get(oci8_bind_t *obind, void *data, void *null_struct)
@@ -493,7 +457,6 @@
     oci8_define_bind_class("Long", &bind_long_class);
     oci8_define_bind_class("LongRaw", &bind_long_raw_class);
 #endif /* USE_DYNAMIC_FETCH */
-    oci8_define_bind_class("Fixnum", &bind_fixnum_class);
     oci8_define_bind_class("Float", &bind_float_class);
     if (oracle_client_version >= ORAVER_10_1) {
         oci8_define_bind_class("BinaryDouble", &bind_binary_double_class);

Modified: trunk/ruby-oci8/ext/oci8/extconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/extconf.rb	2009-05-18 16:49:30 UTC (rev 349)
+++ trunk/ruby-oci8/ext/oci8/extconf.rb	2009-05-19 12:51:28 UTC (rev 350)
@@ -11,6 +11,7 @@
 
 require File.dirname(__FILE__) + '/oraconf'
 require File.dirname(__FILE__) + '/apiwrap'
+require File.dirname(__FILE__) + '/../../lib/oci8/oracle_version.rb'
 
 RUBY_OCI8_VERSION = File.read("#{File.dirname(__FILE__)}/../../VERSION").chomp
 
@@ -70,7 +71,7 @@
 have_type('OCIAdmin*', 'ociap.h')
 
 if with_config('oracle-version')
-  oci_client_version = with_config('oracle-version').to_i
+  oci_client_version = OCI8::OracleVersion.new(with_config('oracle-version')).to_i
 else
   oci_client_version = oci_actual_client_version
 end

Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb
===================================================================
--- trunk/ruby-oci8/ext/oci8/oraconf.rb	2009-05-18 16:49:30 UTC (rev 349)
+++ trunk/ruby-oci8/ext/oci8/oraconf.rb	2009-05-19 12:51:28 UTC (rev 350)
@@ -860,10 +860,31 @@
     def get_home
       oracle_home = ENV['ORACLE_HOME']
       if oracle_home.nil?
-        raise <<EOS
+        msg = <<EOS
 Set the environment variable ORACLE_HOME if Oracle Full Client.
 Append the path of Oracle client libraries to #{OraConf.ld_envs[0]} if Oracle Instant Client.
 EOS
+
+        # check sudo environment
+        sudo_command = ENV['SUDO_COMMAND']
+        if /\w*make\b/ =~ sudo_command
+          msg += <<EOS
+
+'sudo' may unset environment variables for security reasons.
+Use it only when running 'make install' as follows
+     make
+     sudo make install
+EOS
+        end
+        if /\w+\/gem\b/ =~ sudo_command
+          msg += <<EOS
+
+'sudo' may unset environment variables for security reasons.
+Pass required varialbes as follows
+     sudo VAR1=val1 VAR2=val2 #{sudo_command}
+EOS
+        end
+        raise msg
       end
       oracle_home
     end

Modified: trunk/ruby-oci8/lib/oci8/compat.rb
===================================================================
--- trunk/ruby-oci8/lib/oci8/compat.rb	2009-05-18 16:49:30 UTC (rev 349)
+++ trunk/ruby-oci8/lib/oci8/compat.rb	2009-05-19 12:51:28 UTC (rev 350)
@@ -105,4 +105,9 @@
     # add alias compatible with 'Oracle7 Module for Ruby'.
     alias getColNames get_col_names
   end
+
+  module BindType
+    # alias to Integer for compatibility with ruby-oci8 1.0.
+    Fixnum = Integer
+  end
 end




More information about the ruby-oci8-commit mailing list