From nobody at rubyforge.org Wed Mar 11 09:11:09 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Wed, 11 Mar 2009 09:11:09 -0400 (EDT) Subject: [ruby-oci8-commit] [322] trunk/ruby-oci8/ext/oci8: * oraconf.rb: fix big/ little endian checking problem on Mac OS X ppc. Message-ID: <20090311131109.AC3E518580EA@rubyforge.org> Revision: 322 Author: kubo Date: 2009-03-11 09:11:08 -0400 (Wed, 11 Mar 2009) Log Message: ----------- * oraconf.rb: fix big/little endian checking problem on Mac OS X ppc. (contributed by unknown. See: Bug ID 24284 on rubyforge.) Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog branches/ruby-oci8-1.0/ext/oci8/oraconf.rb trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/oraconf.rb Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2009-02-15 14:58:37 UTC (rev 321) +++ branches/ruby-oci8-1.0/ChangeLog 2009-03-11 13:11:08 UTC (rev 322) @@ -1,3 +1,7 @@ +2009-03-11 KUBO Takehiro + * oraconf.rb: fix big/little endian checking problem on Mac OS X ppc. + (contributed by unknown. See: Bug ID 24284 on rubyforge.) + 2009-02-08 KUBO Takehiro * NEWS: add changes between 1.0.3 and 1.0.4. * VERSION: change version to 1.0.4. Modified: branches/ruby-oci8-1.0/ext/oci8/oraconf.rb =================================================================== --- branches/ruby-oci8-1.0/ext/oci8/oraconf.rb 2009-02-15 14:58:37 UTC (rev 321) +++ branches/ruby-oci8-1.0/ext/oci8/oraconf.rb 2009-03-11 13:11:08 UTC (rev 322) @@ -425,7 +425,7 @@ so_ext = 'dylib' check_proc = Proc.new do |file| is_32bit = [0].pack('l!').size == 4 - is_big_endian = "\x01\x02".unpack('s') == 0x0102 + is_big_endian = "\x01\x02".unpack('s')[0] == 0x0102 if is_32bit if is_big_endian this_cpu = :ppc # 32-bit big-endian @@ -444,7 +444,12 @@ if so.cpu.include? this_cpu true else - puts " skip: #{file} is for #{so.cpu} cpu." + if so.cpu.size > 1 + arch_types = so.cpu[0..-2].join(', ') + ' and ' + so.cpu[-1].to_s + else + arch_types = so.cpu[0] + end + puts " skip: #{file} is for #{arch_types} cpu." false end else Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-15 14:58:37 UTC (rev 321) +++ trunk/ruby-oci8/ChangeLog 2009-03-11 13:11:08 UTC (rev 322) @@ -1,3 +1,7 @@ +2009-03-11 KUBO Takehiro + * oraconf.rb: fix big/little endian checking problem on Mac OS X ppc. + (contributed by unknown. See: Bug ID 24284 on rubyforge.) + 2009-02-15 KUBO Takehiro * ext/oci8/ocidatetime.c: fix array DML and DateTime object problem. OCI8::Cursor#bind_param_array(key, array_of_datetime) didn't Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/oraconf.rb 2009-02-15 14:58:37 UTC (rev 321) +++ trunk/ruby-oci8/ext/oci8/oraconf.rb 2009-03-11 13:11:08 UTC (rev 322) @@ -425,7 +425,7 @@ so_ext = 'dylib' check_proc = Proc.new do |file| is_32bit = [0].pack('l!').size == 4 - is_big_endian = "\x01\x02".unpack('s') == 0x0102 + is_big_endian = "\x01\x02".unpack('s')[0] == 0x0102 if is_32bit if is_big_endian this_cpu = :ppc # 32-bit big-endian @@ -444,7 +444,12 @@ if so.cpu.include? this_cpu true else - puts " skip: #{file} is for #{so.cpu} cpu." + if so.cpu.size > 1 + arch_types = so.cpu[0..-2].join(', ') + ' and ' + so.cpu[-1].to_s + else + arch_types = so.cpu[0] + end + puts " skip: #{file} is for #{arch_types} cpu." false end else From nobody at rubyforge.org Tue Mar 17 03:12:13 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 17 Mar 2009 03:12:13 -0400 (EDT) Subject: [ruby-oci8-commit] [323] trunk/ruby-oci8: * ext/oci8/apiwrap.yml: add prototypes for OCIServerVersion() and Message-ID: <20090317071213.6199E18580F6@rubyforge.org> Revision: 323 Author: kubo Date: 2009-03-17 03:12:13 -0400 (Tue, 17 Mar 2009) Log Message: ----------- * ext/oci8/apiwrap.yml: add prototypes for OCIServerVersion() and OCIServerRelease(). * ext/oci8/oci8.c: (1) add a private method OCI8#oracle_server_vernum, which returns Oracle server version number. (2) fix a class method OCI8.oracle_client_vernum when using Oracle client 10.1 or lower. * lib/oci8/datetime.rb: fix year information when fetching a date whose year is between A.D. 1 and A.D. 139. * lib/oci8/oci8.rb: (1) add OCI8#oracle_server_version. * (2) change the default data type for timestamp with time zone from DateTime to Time. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/apiwrap.yml trunk/ruby-oci8/ext/oci8/oci8.c trunk/ruby-oci8/lib/oci8/datetime.rb trunk/ruby-oci8/lib/oci8/oci8.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-03-11 13:11:08 UTC (rev 322) +++ trunk/ruby-oci8/ChangeLog 2009-03-17 07:12:13 UTC (rev 323) @@ -1,3 +1,16 @@ +2009-03-17 KUBO Takehiro + * ext/oci8/apiwrap.yml: add prototypes for OCIServerVersion() and + OCIServerRelease(). + * ext/oci8/oci8.c: (1) add a private method OCI8#oracle_server_vernum, + which returns Oracle server version number. + (2) fix a class method OCI8.oracle_client_vernum when using Oracle + client 10.1 or lower. + * lib/oci8/datetime.rb: fix year information when fetching a date + whose year is between A.D. 1 and A.D. 139. + * lib/oci8/oci8.rb: (1) add OCI8#oracle_server_version. + * (2) change the default data type for timestamp with time zone + from DateTime to Time. + 2009-03-11 KUBO Takehiro * oraconf.rb: fix big/little endian checking problem on Mac OS X ppc. (contributed by unknown. See: Bug ID 24284 on rubyforge.) Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml =================================================================== --- trunk/ruby-oci8/ext/oci8/apiwrap.yml 2009-03-11 13:11:08 UTC (rev 322) +++ trunk/ruby-oci8/ext/oci8/apiwrap.yml 2009-03-17 07:12:13 UTC (rev 323) @@ -773,6 +773,15 @@ - OCIError *errhp - ub4 mode +# round trip: ? +OCIServerVersion: + :version: 800 + :args: - dvoid *hndlp + - OCIError *errhp + - OraText *bufp + - ub4 bufsz + - ub1 hndltype + # round trip: 1 OCIStmtExecute_nb: :version: 800 @@ -1114,6 +1123,17 @@ - ub2 *outbflp - OCIError *errhp +# An undocumented function from Oracle 9i to Oracle 10g. +# This is documented in Oracle 11g. +OCIServerRelease: + :version: 900 + :args: - dvoid *hndlp + - OCIError *errhp + - OraText *bufp + - ub4 bufsz + - ub1 hndltype + - ub4 *version + # # Oracle 9.2 # Modified: trunk/ruby-oci8/ext/oci8/oci8.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.c 2009-03-11 13:11:08 UTC (rev 322) +++ trunk/ruby-oci8/ext/oci8/oci8.c 2009-03-17 07:12:13 UTC (rev 323) @@ -524,11 +524,43 @@ return val; } +/* + * call-seq: + * oracle_server_vernum -> Oracle server version number + * + */ +static VALUE oci8_oracle_server_vernum(VALUE self) +{ + oci8_svcctx_t *svcctx = DATA_PTR(self); + char buf[100]; + ub4 version; + char *p; + + if (have_OCIServerRelease) { + /* Oracle 9i or later */ + oci_lc(OCIServerRelease(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), svcctx->base.type, &version)); + return UINT2NUM(version); + } else { + /* Oracle 8.x */ + oci_lc(OCIServerVersion(svcctx->base.hp.ptr, oci8_errhp, (text*)buf, sizeof(buf), svcctx->base.type)); + if ((p = strchr(buf, '.')) != NULL) { + unsigned int major, minor, update, patch, port_update; + while (p >= buf && *p != ' ') { + p--; + } + if (sscanf(p + 1, "%u.%u.%u.%u.%u", &major, &minor, &update, &patch, &port_update) == 5) { + return INT2FIX(ORAVERNUM(major, minor, update, patch, port_update)); + } + } + return Qnil; + } +} + VALUE Init_oci8(void) { cOCI8 = oci8_define_class("OCI8", &oci8_svcctx_class); - oracle_client_vernum = oracle_client_version; + oracle_client_vernum = INT2FIX(oracle_client_version); if (have_OCIClientVersion) { sword major, minor, update, patch, port_update; OCIClientVersion(&major, &minor, &update, &patch, &port_update); @@ -556,6 +588,7 @@ rb_define_method(cOCI8, "long_read_len=", oci8_set_long_read_len, 1); rb_define_method(cOCI8, "break", oci8_break, 0); rb_define_method(cOCI8, "prefetch_rows=", oci8_set_prefetch_rows, 1); + rb_define_private_method(cOCI8, "oracle_server_vernum", oci8_oracle_server_vernum, 0); return cOCI8; } Modified: trunk/ruby-oci8/lib/oci8/datetime.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/datetime.rb 2009-03-11 13:11:08 UTC (rev 322) +++ trunk/ruby-oci8/lib/oci8/datetime.rb 2009-03-17 07:12:13 UTC (rev 323) @@ -20,7 +20,7 @@ # # This parameter is used when both or either of Oracle server and client # version is Oracle 8i or lower. If both versions are Oracle 9i or upper, - # the default timezone is determined by session timezone. + # the default timezone is determined by the session timezone. def self.default_timezone=(tz) if tz != :local and tz != :utc raise ArgumentError, "expected :local or :utc but #{tz}" @@ -111,11 +111,13 @@ def ocidate_to_time(ary) year, month, day, hour, minute, sec = ary - begin - ::Time.send(@@default_timezone, year, month, day, hour, minute, sec) - rescue StandardError - ocidate_to_datetime(ary) + if year >= 139 + begin + ::Time.send(@@default_timezone, year, month, day, hour, minute, sec) + rescue StandardError + end end + ocidate_to_datetime(ary) end if OCI8.oracle_client_version >= ORAVER_9_0 @@ -149,7 +151,7 @@ elsif @@time_offset == tz_hour * 3600 + tz_min * 60 timezone = :local end - if timezone + if timezone and year >= 139 begin # Ruby 1.9 Time class's resolution is nanosecond. # But the last argument type is millisecond. Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2009-03-11 13:11:08 UTC (rev 322) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2009-03-17 07:12:13 UTC (rev 323) @@ -135,6 +135,31 @@ "#" end + # :call-seq: + # oracle_server_version -> oraver + # + # Returns an OCI8::OracleVersion of the Oracle server version. + # + # See also: OCI8.oracle_client_version + def oracle_server_version + unless defined? @oracle_server_version + if vernum = oracle_server_vernum + # If the Oracle client is Oracle 9i or upper, + # get the server version from the OCI function OCIServerRelease. + @oracle_server_version = OCI8::OracleVersion.new(vernum) + else + # Otherwise, get it from v$version. + self.exec('select banner from v$version') do |row| + if /^Oracle.*?(\d+\.\d+\.\d+\.\d+\.\d+)/ =~ row[0] + @oracle_server_version = OCI8::OracleVersion.new($1) + break + end + end + end + end + @oracle_server_version + end + module BindType Mapping = {} @@ -703,7 +728,7 @@ if OCI8.oracle_client_version >= OCI8::ORAVER_9_0 OCI8::BindType::Mapping[:timestamp] = OCI8::BindType::Time - OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::DateTime + OCI8::BindType::Mapping[:timestamp_tz] = OCI8::BindType::Time OCI8::BindType::Mapping[:timestamp_ltz] = OCI8::BindType::Time OCI8::BindType::Mapping[:interval_ym] = OCI8::BindType::IntervalYM OCI8::BindType::Mapping[:interval_ds] = OCI8::BindType::IntervalDS From nobody at rubyforge.org Tue Mar 17 10:20:13 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 17 Mar 2009 10:20:13 -0400 (EDT) Subject: [ruby-oci8-commit] [324] branches/ruby-oci8-1.0: * NEWS: add changes between 1.0.4 and 1.0.5. Message-ID: <20090317142013.9DB4A18580F7@rubyforge.org> Revision: 324 Author: kubo Date: 2009-03-17 10:20:13 -0400 (Tue, 17 Mar 2009) Log Message: ----------- * NEWS: add changes between 1.0.4 and 1.0.5. * VERSION: change version to 1.0.5. Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog branches/ruby-oci8-1.0/NEWS branches/ruby-oci8-1.0/VERSION Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2009-03-17 07:12:13 UTC (rev 323) +++ branches/ruby-oci8-1.0/ChangeLog 2009-03-17 14:20:13 UTC (rev 324) @@ -1,3 +1,7 @@ +2009-03-17 KUBO Takehiro + * NEWS: add changes between 1.0.4 and 1.0.5. + * VERSION: change version to 1.0.5. + 2009-03-11 KUBO Takehiro * oraconf.rb: fix big/little endian checking problem on Mac OS X ppc. (contributed by unknown. See: Bug ID 24284 on rubyforge.) Modified: branches/ruby-oci8-1.0/NEWS =================================================================== --- branches/ruby-oci8-1.0/NEWS 2009-03-17 07:12:13 UTC (rev 323) +++ branches/ruby-oci8-1.0/NEWS 2009-03-17 14:20:13 UTC (rev 324) @@ -1,3 +1,10 @@ +1.0.5: + +No changes for who try to install on Mac OS X ppc. + +- fix big/little endian checking problem on Mac OS X ppc. + (contributed by unknown. See: Bug ID 24284 on rubyforge.) + 1.0.4: 1. [dbi] support ruby-dbi 0.4 Modified: branches/ruby-oci8-1.0/VERSION =================================================================== --- branches/ruby-oci8-1.0/VERSION 2009-03-17 07:12:13 UTC (rev 323) +++ branches/ruby-oci8-1.0/VERSION 2009-03-17 14:20:13 UTC (rev 324) @@ -1 +1 @@ -1.0.4 \ No newline at end of file +1.0.5 \ No newline at end of file From nobody at rubyforge.org Tue Mar 17 10:51:55 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 17 Mar 2009 10:51:55 -0400 (EDT) Subject: [ruby-oci8-commit] [325] tags/ruby-oci8-1.0.5/: tag ruby-oci8-1.0.5 Message-ID: <20090317145155.4798518580EB@rubyforge.org> Revision: 325 Author: kubo Date: 2009-03-17 10:51:54 -0400 (Tue, 17 Mar 2009) Log Message: ----------- tag ruby-oci8-1.0.5 Added Paths: ----------- tags/ruby-oci8-1.0.5/ Property changes on: tags/ruby-oci8-1.0.5 ___________________________________________________________________ Added: svn:ignore + config.save sqlnet.log ruby-oci8.spec Added: svn:mergeinfo + From nobody at rubyforge.org Tue Mar 17 11:03:49 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 17 Mar 2009 11:03:49 -0400 (EDT) Subject: [ruby-oci8-commit] [326] fix typo Message-ID: <20090317150350.2C26018580EB@rubyforge.org> Revision: 326 Author: kubo Date: 2009-03-17 11:03:49 -0400 (Tue, 17 Mar 2009) Log Message: ----------- fix typo Modified Paths: -------------- branches/ruby-oci8-1.0/NEWS tags/ruby-oci8-1.0.5/NEWS Modified: branches/ruby-oci8-1.0/NEWS =================================================================== --- branches/ruby-oci8-1.0/NEWS 2009-03-17 14:51:54 UTC (rev 325) +++ branches/ruby-oci8-1.0/NEWS 2009-03-17 15:03:49 UTC (rev 326) @@ -1,6 +1,6 @@ 1.0.5: -No changes for who try to install on Mac OS X ppc. +No changes except who try to install on Mac OS X ppc. - fix big/little endian checking problem on Mac OS X ppc. (contributed by unknown. See: Bug ID 24284 on rubyforge.) Modified: tags/ruby-oci8-1.0.5/NEWS =================================================================== --- tags/ruby-oci8-1.0.5/NEWS 2009-03-17 14:51:54 UTC (rev 325) +++ tags/ruby-oci8-1.0.5/NEWS 2009-03-17 15:03:49 UTC (rev 326) @@ -1,6 +1,6 @@ 1.0.5: -No changes for who try to install on Mac OS X ppc. +No changes except who try to install on Mac OS X ppc. - fix big/little endian checking problem on Mac OS X ppc. (contributed by unknown. See: Bug ID 24284 on rubyforge.) From nobody at rubyforge.org Tue Mar 17 11:55:22 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 17 Mar 2009 11:55:22 -0400 (EDT) Subject: [ruby-oci8-commit] [327] trunk/ruby-oci8: * NEWS: add a new file. Message-ID: <20090317155522.C56A2197828E@rubyforge.org> Revision: 327 Author: kubo Date: 2009-03-17 11:55:22 -0400 (Tue, 17 Mar 2009) Log Message: ----------- * NEWS: add a new file. * VERSION: change version to 2.0.1. * Makefile: add targets to make a binary gem for Windows. * dist-files: add NEWS * ext/oci8/extconf.rb, lib/oci8.rb.in: rename oci8lib.so to oci8lib_18.so and oci8lib_191.so. The renamed name depends on the ruby version. * lib/oci8/datetime.rb: fix the fetched type for date column when using Oracle 8.x. * ruby-oci8.gemspec: fix to make a binary gem which contains both oci8lib_18.so and oci8lib_191.so. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/Makefile trunk/ruby-oci8/VERSION trunk/ruby-oci8/dist-files trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/lib/oci8/datetime.rb trunk/ruby-oci8/lib/oci8.rb.in trunk/ruby-oci8/ruby-oci8.gemspec Added Paths: ----------- trunk/ruby-oci8/NEWS Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/ChangeLog 2009-03-17 15:55:22 UTC (rev 327) @@ -1,4 +1,17 @@ 2009-03-17 KUBO Takehiro + * NEWS: add a new file. + * VERSION: change version to 2.0.1. + * Makefile: add targets to make a binary gem for Windows. + * dist-files: add NEWS + * ext/oci8/extconf.rb, lib/oci8.rb.in: rename oci8lib.so + to oci8lib_18.so and oci8lib_191.so. The renamed name + depends on the ruby version. + * lib/oci8/datetime.rb: fix the fetched type for date column + when using Oracle 8.x. + * ruby-oci8.gemspec: fix to make a binary gem which contains + both oci8lib_18.so and oci8lib_191.so. + +2009-03-17 KUBO Takehiro * ext/oci8/apiwrap.yml: add prototypes for OCIServerVersion() and OCIServerRelease(). * ext/oci8/oci8.c: (1) add a private method OCI8#oracle_server_vernum, Modified: trunk/ruby-oci8/Makefile =================================================================== --- trunk/ruby-oci8/Makefile 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/Makefile 2009-03-17 15:55:22 UTC (rev 327) @@ -46,3 +46,42 @@ cd ruby-oci8-$(VERSION) && $(MAKE) RUBY="$(RUBY)" check cd ruby-oci8-$(VERSION)/src && $(MAKE) RUBY="$(RUBY)" sitearchdir=../work sitelibdir=../work site-install cd ruby-oci8-$(VERSION)/test && $(RUBY) -I../work -I../support test_all.rb + +# +# for Windows +# +GEMPKG = ruby-oci8-unstable-2.0.1-x86-mswin32-60.gem + +ext\oci8\oci8lib_18.so: + c:\ruby\bin\ruby -r fileutils -e "FileUtils.rm_rf('ruby18')" + md ruby18 + cd ruby18 + c:\ruby\bin\ruby ..\setup.rb config -- --with-runtime-check + c:\ruby\bin\ruby ..\setup.rb setup + rem c:\ruby\bin\ruby ..\setup.rb test + cd .. + copy ruby18\ext\oci8\oci8lib_18.so ext\oci8\oci8lib_18.so + +ext\oci8\oci8lib_191.so: + c:\ruby\bin\ruby -r fileutils -e "FileUtils.rm_rf('ruby191')" + md ruby191 + cd ruby191 + c:\ruby-1.9.1\bin\ruby ..\setup.rb config -- --with-runtime-check + c:\ruby-1.9.1\bin\ruby ..\setup.rb setup + rem c:\ruby-1.9.1\bin\ruby ..\setup.rb test + cd .. + copy ruby191\ext\oci8\oci8lib_191.so ext\oci8\oci8lib_191.so + copy ruby191\lib\oci8.rb lib\oci8.rb + +$(GEMPKG): ext\oci8\oci8lib_18.so ext\oci8\oci8lib_191.so ruby-oci8.gemspec + c:\ruby-1.9.1\bin\gem build ruby-oci8.gemspec -- current + +test-win32-ruby18: $(GEMPKG) + c:\ruby\bin\gem install $(GEMPKG) --no-rdoc --no-ri + c:\ruby\bin\ruby -rubygems test\test_all.rb + +test-win32-ruby191: $(GEMPKG) + c:\ruby-1.9.1\bin\gem install $(GEMPKG) --no-rdoc --no-ri + c:\ruby-1.9.1\bin\ruby test\test_all.rb + +test-win32: test-win32-ruby18 test-win32-ruby191 Added: trunk/ruby-oci8/NEWS =================================================================== --- trunk/ruby-oci8/NEWS (rev 0) +++ trunk/ruby-oci8/NEWS 2009-03-17 15:55:22 UTC (rev 327) @@ -0,0 +1,6 @@ +2.0.1: + +* release a binary gem for Windows, which contains libraries for both + ruby 1.8 and ruby 1.9.1. +* add OCI8#oracle_server_version. +* fix bugs when fetching and binding time objects. Modified: trunk/ruby-oci8/VERSION =================================================================== --- trunk/ruby-oci8/VERSION 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/VERSION 2009-03-17 15:55:22 UTC (rev 327) @@ -1 +1 @@ -2.0.0 +2.0.1 Modified: trunk/ruby-oci8/dist-files =================================================================== --- trunk/ruby-oci8/dist-files 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/dist-files 2009-03-17 15:55:22 UTC (rev 327) @@ -1,5 +1,6 @@ ChangeLog Makefile +NEWS README VERSION dist-files Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2009-03-17 15:55:22 UTC (rev 327) @@ -113,6 +113,16 @@ # make ruby script before running create_makefile. replace_keyword(File.dirname(__FILE__) + '/../../lib/oci8.rb.in', '../../lib/oci8.rb', replace) +case RUBY_VERSION +when /^1\.9\.1/ + so_basename = "oci8lib_191" +when /^1\.8/ + so_basename = "oci8lib_18" +else + raise 'unsupported ruby version: ' + RUBY_VERSION +end +$defs << "-DInit_oci8lib=Init_#{so_basename}" + create_header() # make dependency file @@ -140,6 +150,6 @@ create_apiwrap() -create_makefile("oci8lib") +create_makefile(so_basename) exit 0 Modified: trunk/ruby-oci8/lib/oci8/datetime.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/datetime.rb 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/lib/oci8/datetime.rb 2009-03-17 15:55:22 UTC (rev 327) @@ -113,7 +113,7 @@ year, month, day, hour, minute, sec = ary if year >= 139 begin - ::Time.send(@@default_timezone, year, month, day, hour, minute, sec) + return ::Time.send(@@default_timezone, year, month, day, hour, minute, sec) rescue StandardError end end Modified: trunk/ruby-oci8/lib/oci8.rb.in =================================================================== --- trunk/ruby-oci8/lib/oci8.rb.in 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/lib/oci8.rb.in 2009-03-17 15:55:22 UTC (rev 327) @@ -18,7 +18,14 @@ end end -require 'oci8lib' +case RUBY_VERSION +when /^1\.9\.1/ + require 'oci8lib_191' +when /^1\.8/ + require 'oci8lib_18' +else + raise 'unsupported ruby version: ' + RUBY_VERSION +end if OCI8.respond_to? :encoding if defined? DEFAULT_OCI8_ENCODING Modified: trunk/ruby-oci8/ruby-oci8.gemspec =================================================================== --- trunk/ruby-oci8/ruby-oci8.gemspec 2009-03-17 15:03:49 UTC (rev 326) +++ trunk/ruby-oci8/ruby-oci8.gemspec 2009-03-17 15:55:22 UTC (rev 327) @@ -6,6 +6,7 @@ # To make a binary gems package: # gem build ruby-oci8.gemspec -- current # +require 'fileutils' if ARGV.size > 3 gem_platform = ARGV[3] @@ -28,27 +29,35 @@ s.platform = gem_platform files = File.read('dist-files').split("\n") if gem_platform == Gem::Platform::RUBY - s.require_paths = ['lib'] s.extensions << 'ext/oci8/extconf.rb' s.required_ruby_version = '>= 1.8.0' else - s.require_paths = ['lib', 'ext/oci8'] - if RUBY_VERSION =~ /^1\.9\./ + so_files = Dir.glob('ext/oci8/oci8lib_*.so') + has_1_8 = so_files.include? 'ext/oci8/oci8lib_18.so' + has_1_9_1 = so_files.include? 'ext/oci8/oci8lib_191.so' + if has_1_8 and has_1_9_1 + puts 'Binary gem for ruby 1.8 and 1.9.1' + s.required_ruby_version = '>= 1.8.0' + elsif has_1_8 and !has_1_9_1 + puts 'Binary gem for ruby 1.8' + s.required_ruby_version = '~> 1.8.0' + elsif !has_1_8 and has_1_9_1 + puts 'Binary gem for ruby 1.9.1' s.required_ruby_version = '~> 1.9.1' else - s.required_ruby_version = '~> 1.8.0' + raise "No compiled binary are found. Run make in advance." end - # check files created by a make command. - ['ext/oci8/oci8lib.so', 'lib/oci8.rb'].each do |file| - raise < true + files.reject! do |fname| + fname =~ /^ext/ end + so_files.each do |fname| + files << 'lib/' + File.basename(fname) + end + files << 'lib/oci8.rb' end s.files = files s.test_files = 'test/test_all.rb' - s.rdoc_options = ['--main', 'README', '--exclude', 'ext/*'] + s.rdoc_options = ['--main', 'README'] s.extra_rdoc_files = ['README'] end From nobody at rubyforge.org Mon Mar 23 21:37:44 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Mon, 23 Mar 2009 21:37:44 -0400 (EDT) Subject: [ruby-oci8-commit] [329] trunk/ruby-oci8: * ext/oci8/extconf.rb, ext/oci8/oci8.h: fix a problem when Message-ID: <20090324013744.56E931978565@rubyforge.org> Revision: 329 Author: kubo Date: 2009-03-23 21:37:43 -0400 (Mon, 23 Mar 2009) Log Message: ----------- * ext/oci8/extconf.rb, ext/oci8/oci8.h: fix a problem when compiling with Oracle 9.2. * ext/oci8/apiwrap.yml: suppres warnings 'discards qualifiers from pointer target type' when compiling with Oracle 8i. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/apiwrap.yml trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/ext/oci8/oci8.h Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-03-17 16:26:03 UTC (rev 328) +++ trunk/ruby-oci8/ChangeLog 2009-03-24 01:37:43 UTC (rev 329) @@ -1,3 +1,9 @@ +2009-03-24 KUBO Takehiro + * ext/oci8/extconf.rb, ext/oci8/oci8.h: fix a problem when + compiling with Oracle 9.2. + * ext/oci8/apiwrap.yml: suppres warnings 'discards qualifiers + from pointer target type' when compiling with Oracle 8i. + 2009-03-17 KUBO Takehiro * NEWS: add a new file. * VERSION: change version to 2.0.1. Modified: trunk/ruby-oci8/ext/oci8/apiwrap.yml =================================================================== --- trunk/ruby-oci8/ext/oci8/apiwrap.yml 2009-03-17 16:26:03 UTC (rev 328) +++ trunk/ruby-oci8/ext/oci8/apiwrap.yml 2009-03-24 01:37:43 UTC (rev 329) @@ -6,7 +6,7 @@ # use thie for 0 round trip OCIAttrGet: :version: 800 - :args: - const dvoid *trgthndlp + :args: - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -16,7 +16,7 @@ # use thie for 1 or 2 round trips OCIAttrGet_nb: :version: 800 - :args: - const dvoid *trgthndlp + :args: - CONST dvoid *trgthndlp - ub4 trghndltyp - dvoid *attributep - ub4 *sizep @@ -48,7 +48,7 @@ :args: - OCIStmt *stmtp - OCIBind **bindp - OCIError *errhp - - const text *placeholder + - CONST text *placeholder - sb4 placeh_len - dvoid *valuep - sb4 value_sz @@ -82,7 +82,7 @@ :version: 800 :args: - OCIBind *bindp - OCIError *errhp - - const OCIType *type + - CONST OCIType *type - dvoid **pgvpp - ub4 *pvszsp - dvoid **indpp @@ -99,8 +99,8 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const dvoid *elem - - const dvoid *elemind + - CONST dvoid *elem + - CONST dvoid *elemind - OCIColl *coll # round trip: 0 @@ -109,8 +109,8 @@ :args: - OCIEnv *env - OCIError *err - sb4 index - - const dvoid *elem - - const dvoid *elemind + - CONST dvoid *elem + - CONST dvoid *elemind - OCIColl *coll # round trip: 0 @@ -118,7 +118,7 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const OCIColl *coll + - CONST OCIColl *coll - sb4 index - boolean *exists - dvoid **elem @@ -129,7 +129,7 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const OCIColl *coll + - CONST OCIColl *coll - sb4 *size # round trip: 0 @@ -170,7 +170,7 @@ :version: 800 :args: - OCIDefine *defnp - OCIError *errhp - - const OCIType *type + - CONST OCIType *type - dvoid **pgvpp - ub4 *pvszsp - dvoid **indpp @@ -190,7 +190,7 @@ OCIDescriptorAlloc: :version: 800 - :args: - const dvoid *parenth + :args: - CONST dvoid *parenth - dvoid **descpp - ub4 type - size_t xtramem_sz @@ -220,7 +220,7 @@ OCIHandleAlloc: :version: 800 - :args: - const dvoid *parenth + :args: - CONST dvoid *parenth - dvoid **hndlpp - ub4 type - size_t xtramem_sz @@ -245,7 +245,7 @@ :version: 800 :args: - OCIEnv *envhp - OCIError *errhp - - const OCILobLocator *src_locp + - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp # round trip: 1 @@ -274,7 +274,7 @@ :version: 800 :args: - OCIEnv *envhp - OCIError *errhp - - const OCILobLocator *filep + - CONST OCILobLocator *filep - text *dir_alias - ub2 *d_length - text *filename @@ -294,9 +294,9 @@ :args: - OCIEnv *envhp - OCIError *errhp - OCILobLocator **filepp - - const text *dir_alias + - CONST text *dir_alias - ub2 d_length - - const text *filename + - CONST text *filename - ub2 f_length # round trip: 1 @@ -312,7 +312,7 @@ :version: 800 :args: - OCIEnv *envhp - OCIError *errhp - - const OCILobLocator *locp + - CONST OCILobLocator *locp - boolean *is_initialized # round trip: 0 or 1 @@ -366,113 +366,113 @@ :args: - OCIEnv *envhp - OCIError *errhp - OCISvcCtx **svchp - - const text *username + - CONST text *username - ub4 uname_len - - const text *password + - CONST text *password - ub4 passwd_len - - const text *dbname + - CONST text *dbname - ub4 dbname_len # round trip: 0 OCINumberAbs: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberAdd: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberArcCos: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcSin: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberArcTan2: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberAssign: :version: 800 :args: - OCIError *err - - const OCINumber *from + - CONST OCINumber *from - OCINumber *to # round trip: 0 OCINumberCeil: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberCmp: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - sword *result # round trip: 0 OCINumberCos: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberDiv: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberExp: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFloor: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberFromInt: :version: 800 :args: - OCIError *err - - const dvoid *inum + - CONST dvoid *inum - uword inum_length - uword inum_s_flag - OCINumber *number @@ -481,7 +481,7 @@ OCINumberFromReal: :version: 800 :args: - OCIError *err - - const dvoid *rnum + - CONST dvoid *rnum - uword rnum_length - OCINumber *number @@ -489,11 +489,11 @@ OCINumberFromText: :version: 800 :args: - OCIError *err - - const text *str + - CONST text *str - ub4 str_length - - const text *fmt + - CONST text *fmt - ub4 fmt_length - - const text *nls_params + - CONST text *nls_params - ub4 nls_p_length - OCINumber *number @@ -501,89 +501,89 @@ OCINumberHypCos: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypSin: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberHypTan: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberIntPower: :version: 800 :args: - OCIError *err - - const OCINumber *base - - const sword exp + - CONST OCINumber *base + - CONST sword exp - OCINumber *result # round trip: 0 OCINumberIsZero: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - boolean *result # round trip: 0 OCINumberLn: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberLog: :version: 800 :args: - OCIError *err - - const OCINumber *base - - const OCINumber *number + - CONST OCINumber *base + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberMod: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberMul: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberNeg: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberPower: :version: 800 :args: - OCIError *err - - const OCINumber *base - - const OCINumber *number + - CONST OCINumber *base + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberRound: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - sword decplace - OCINumber *result @@ -598,36 +598,36 @@ OCINumberSin: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberSub: :version: 800 :args: - OCIError *err - - const OCINumber *number1 - - const OCINumber *number2 + - CONST OCINumber *number1 + - CONST OCINumber *number2 - OCINumber *result # round trip: 0 OCINumberSqrt: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberTan: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - OCINumber *result # round trip: 0 OCINumberToInt: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - uword rsl_length - uword rsl_flag - dvoid *rsl @@ -636,7 +636,7 @@ OCINumberToReal: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - uword rsl_length - dvoid *rsl @@ -644,10 +644,10 @@ OCINumberToText: :version: 800 :args: - OCIError *err - - const OCINumber *number - - const text *fmt + - CONST OCINumber *number + - CONST text *fmt - ub4 fmt_length - - const text *nls_params + - CONST text *nls_params - ub4 nls_p_length - ub4 *buf_size - text *buf @@ -656,7 +656,7 @@ OCINumberTrunc: :version: 800 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - sword decplace - OCINumber *resulty @@ -681,7 +681,7 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const OCISvcCtx *svc + - CONST OCISvcCtx *svc - OCITypeCode typecode - OCIType *tdo - dvoid *table @@ -711,7 +711,7 @@ # round trip: ??? OCIParamGet: :version: 800 - :args: - const dvoid *hndlp + :args: - CONST dvoid *hndlp - ub4 htype - OCIError *errhp - dvoid **parmdpp @@ -731,7 +731,7 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const ub1 *rhs + - CONST ub1 *rhs - ub4 rhs_len - OCIRaw **lhs @@ -740,14 +740,14 @@ :version: 800 :ret: ub1 * :args: - OCIEnv *env - - const OCIRaw *raw + - CONST OCIRaw *raw # round trip: 0 OCIRawSize: :version: 800 :ret: ub4 :args: - OCIEnv *env - - const OCIRaw *raw + - CONST OCIRaw *raw # round trip: 1 OCISessionEnd_nb: @@ -762,7 +762,7 @@ :version: 800 :args: - OCIServer *srvhp - OCIError *errhp - - const text *dblink + - CONST text *dblink - sb4 dblink_len - ub4 mode @@ -790,7 +790,7 @@ - OCIError *errhp - ub4 iters - ub4 rowoff - - const OCISnapshot *snap_in + - CONST OCISnapshot *snap_in - OCISnapshot *snap_out - ub4 mode @@ -818,7 +818,7 @@ :version: 800 :args: - OCIStmt *stmtp - OCIError *errhp - - const text *stmt + - CONST text *stmt - ub4 stmt_len - ub4 language - ub4 mode @@ -828,10 +828,10 @@ :args: - dvoid *hndlp - ub4 type - OCIError *errhp - - const dvoid *bufp + - CONST dvoid *bufp - ub4 *alenp - ub1 piece - - const dvoid *indp + - CONST dvoid *indp - ub2 *rcodep # round trip: 0 @@ -839,7 +839,7 @@ :version: 800 :args: - OCIEnv *env - OCIError *err - - const text *rhs + - CONST text *rhs - ub4 rhs_len - OCIString **lhs @@ -848,14 +848,14 @@ :version: 800 :ret: text * :args: - OCIEnv *env - - const OCIString *vs + - CONST OCIString *vs # round trip: 0 OCIStringSize: :version: 800 :ret: ub4 :args: - OCIEnv *env - - const OCIString *vs + - CONST OCIString *vs # round trip: 1 OCITransCommit_nb: @@ -877,7 +877,7 @@ :ret: OCITypeCode :args: - OCIEnv *env - OCIError *err - - const OCIType *tdo + - CONST OCIType *tdo # @@ -924,7 +924,7 @@ :version: 810 :args: - OCISvcCtx *svchp - OCIError *errhp - - const OCILobLocator *src_locp + - CONST OCILobLocator *src_locp - OCILobLocator **dst_locpp # round trip 1 @@ -939,7 +939,7 @@ OCINumberIsInt: :version: 810 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - boolean *result :code_if_not_found: | /* pseude code @@ -966,7 +966,7 @@ OCINumberPrec: :version: 810 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - eword nDigs - OCINumber *result @@ -988,15 +988,15 @@ OCINumberShift: :version: 810 :args: - OCIError *err - - const OCINumber *number - - const sword nDig + - CONST OCINumber *number + - CONST sword nDig - OCINumber *result # round trip: 0 OCINumberSign: :version: 810 :args: - OCIError *err - - const OCINumber *number + - CONST OCINumber *number - sword *result :code_if_not_found: | /* pseude code @@ -1048,7 +1048,7 @@ :version: 900 :args: - dvoid *hndl - OCIError *err - - const OCIDateTime *date + - CONST OCIDateTime *date - sb2 *yr - ub1 *mnth - ub1 *dy @@ -1069,7 +1069,7 @@ :version: 900 :args: - dvoid *hndl - OCIError *err - - const OCIDateTime *datetime + - CONST OCIDateTime *datetime - sb1 *hr - sb1 *mm @@ -1083,7 +1083,7 @@ - sb4 *mm - sb4 *ss - sb4 *fsec - - const OCIInterval *result + - CONST OCIInterval *result # round trip: 0 (not docmented. I guess.) OCIIntervalGetYearMonth: @@ -1092,7 +1092,7 @@ - OCIError *err - sb4 *yr - sb4 *mnth - - const OCIInterval *result + - CONST OCIInterval *result # round trip: 0 (not docmented. I guess.) OCIIntervalSetDaySecond: Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2009-03-17 16:26:03 UTC (rev 328) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2009-03-24 01:37:43 UTC (rev 329) @@ -63,6 +63,9 @@ end $defs << "-DACTUAL_ORACLE_CLIENT_VERSION=#{format('0x%08x', oci_actual_client_version)}" +have_type('OCICallbackLobRead2', 'ociap.h') +have_type('OCICallbackLobWrite2', 'ociap.h') + if with_config('oracle-version') oci_client_version = with_config('oracle-version').to_i else Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2009-03-17 16:26:03 UTC (rev 328) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2009-03-24 01:37:43 UTC (rev 329) @@ -53,6 +53,30 @@ typedef struct OCIAdmin OCIAdmin; #endif +#ifndef ORAXB8_DEFINED +#if SIZEOF_LONG == 8 +typedef unsigned long oraub8; +typedef signed long orasb8; +#elif SIZEOF_LONG_LONG == 8 +typedef unsigned long long oraub8; +typedef signed long long orasb8; +#elif SIZEOF___INT64 == 8 +typedef unsigned __int64 oraub8; +typedef signed __int64 orasb8; +#endif +#endif /* ORAXB8_DEFINED */ + +#ifndef HAVE_TYPE_OCICALLBACKLOBREAD2 +typedef sb4 (*OCICallbackLobRead2)(dvoid *ctxp, CONST dvoid *bufp, oraub8 len, + ub1 piece, dvoid **changed_bufpp, + oraub8 *changed_lenp); +#endif +#ifndef HAVE_TYPE_OCICALLBACKLOBWRITE2 +typedef sb4 (*OCICallbackLobWrite2)(dvoid *ctxp, dvoid *bufp, oraub8 *lenp, + ub1 *piece, dvoid **changed_bufpp, + oraub8 *changed_lenp); +#endif + /* new macros in ruby 1.8.6. * define compatible macros for ruby 1.8.5 or lower. */ From nobody at rubyforge.org Tue Mar 24 11:08:38 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 24 Mar 2009 11:08:38 -0400 (EDT) Subject: [ruby-oci8-commit] [330] trunk/ruby-oci8: * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/ oraconf.rb: Message-ID: <20090324150838.4D7E418580EB@rubyforge.org> 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 + * 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 * 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 #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