From nobody at rubyforge.org Sun Feb 1 09:39:26 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 1 Feb 2009 09:39:26 -0500 (EST) Subject: [ruby-oci8-commit] [312] web: * hiki_data/en/text/PlatformSpecificIssue, hiki_data/ja/text/ PlatformSpecificIssue Message-ID: <20090201143926.233CD18580ED@rubyforge.org> Revision: 312 Author: kubo Date: 2009-02-01 09:39:25 -0500 (Sun, 01 Feb 2009) Log Message: ----------- * hiki_data/en/text/PlatformSpecificIssue, hiki_data/ja/text/PlatformSpecificIssue update Mac OS X and FreeBSD information. Modified Paths: -------------- web/ChangeLog web/hiki_data/en/info.db web/hiki_data/en/text/PlatformSpecificIssue web/hiki_data/ja/info.db web/hiki_data/ja/text/PlatformSpecificIssue Modified: web/ChangeLog =================================================================== --- web/ChangeLog 2009-01-31 14:17:56 UTC (rev 311) +++ web/ChangeLog 2009-02-01 14:39:25 UTC (rev 312) @@ -1,3 +1,7 @@ +2009-02-01 KUBO Takehiro + * hiki_data/en/text/PlatformSpecificIssue, hiki_data/ja/text/PlatformSpecificIssue + update Mac OS X and FreeBSD information. + 2008-12-14 KUBO Takehiro * hiki_data/en/text/PlatformSpecificIssue, hiki_data/ja/text/PlatformSpecificIssue update FreeBSD information that oracle8-client port doesn't Modified: web/hiki_data/en/info.db =================================================================== --- web/hiki_data/en/info.db 2009-01-31 14:17:56 UTC (rev 311) +++ web/hiki_data/en/info.db 2009-02-01 14:39:25 UTC (rev 312) @@ -136,9 +136,8 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1229260669), +:last_modified => Time.at(1233498784), :references => [ -"InstallForInstantClient", "InstallForFullClient", ], :title => "Platform Specific Issues", Modified: web/hiki_data/en/text/PlatformSpecificIssue =================================================================== --- web/hiki_data/en/text/PlatformSpecificIssue 2009-01-31 14:17:56 UTC (rev 311) +++ web/hiki_data/en/text/PlatformSpecificIssue 2009-02-01 14:39:25 UTC (rev 312) @@ -1,9 +1,7 @@ ! Intel Mac -Oracle hasn't provided intel mac binary yet. -[[Oracle Instant Client]] 10.1.0.3 is ppc. It doesn't work with intel ruby. - -There are two workarounds. +The Intel Instant client needs Mac OS X 10.5 Leopard. +There are two workarounds to work on 10.4 Tiger. # compile ruby as ppc. (look at [[Raimonds Simanovskis's blog|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]]) # use [[ruby-odbc|http://www.ch-werner.de/rubyodbc/]] and a third party ODBC driver ([[Actual Technologies|http://www.actualtechnologies.com/]] or [[OpenLink Software|http://uda.openlinksw.com/]]). @@ -28,18 +26,56 @@ To check which type of ruby do you use: file `which ruby` -note: '''`''' is a backquote. +note: '''`''' is a back quote. ! FreeBSD There are two ways. -# use ruby and instantclient on linux emulator (Does anyone write the procedure?) +# use ruby and instant client on linux emulator # use oracle8-client port I don't recommend the latter because of the following two reasons. -# The oracle8-clint port is made from Oracle 8.1.7.1 static library for Linux. Oracle have not supported the connectability between 8.1.7.1 and Oracle 10g. +# The oracle8-client port is made from Oracle 8.1.7.1 static library for Linux. Oracle have not supported the connectivity between 8.1.7.1 and Oracle 10g. # It is very unstable. When it fails to connect to an Oracle server, it is down by segmentation fault on FreeBSD 7.0 not only when using ruby-oci8, but also by a very simple test code written by C. +1. use ruby and instant client on linux emulator + +I have not run ruby-oci8 on linux emulator, but I guess it will +run as follows. If it works, please tell me. + +If FreeBSD has a cross-compiler which can generate linux binaries, +use it to compile ruby and ruby-oci8. + +If FreeBSD doesn't have such a compiler, install a linux distribution +which FreeBSD can emulate to a PC machine, make ruby and ruby-oci8 in +the linux box and copy them to the FreeBSD box as follows. + + on linux + # make ruby + tar xvfz ruby-1.8.x.tar.gz + cd ruby-1.8.x + ./configure --prefix=/usr/local/ruby-1.8.x --enable-pthread + make + make install + # setup instant client + .... + # make ruby-oci8 + PATH=/usr/local/ruby-1.8.x/bin:$PATH + tar xvfz ruby-oci8-1.0.x.tar.gz + cd ruby-oci8-1.0.x + make + make install + cd /usr/local/ + tar cvfz ruby-1.8.x-linux.tar.gz ruby-1.8.x + + copy ruby-1.8.x-linux.tar.gz to the FreeBSD box. + + on freebsd + cd /compat/linux/usr/local + tar xvfz ruby-1.8.x-linux.tar.gz + +2. use oracle8-client port + If you try to use oracle8-client port, compile and install as follows. * install oracle8-client cd /usr/ports/databases/oracle8-client @@ -47,11 +83,6 @@ make install * set an environment variable ORACLE_HOME export ORACLE_HOME=/usr/local/oracle8-client -* extract ruby-oci8 tarball and replace oraconf.rb. - tar xvfz ruby-oci8-1.0.0-rc3.tar.gz - cd ruby-oci8-1.0.0-rc3/ext/oci8 - mv oraconf.rb oraconf.rb.orig - wget http://ruby-oci8.rubyforge.org/svn/branches/ruby-oci8-1.0/ext/oci8/oraconf.rb The rest procedures are described at [[this page|InstallForFullClient]]. Modified: web/hiki_data/ja/info.db =================================================================== --- web/hiki_data/ja/info.db 2009-01-31 14:17:56 UTC (rev 311) +++ web/hiki_data/ja/info.db 2009-02-01 14:39:25 UTC (rev 312) @@ -135,9 +135,8 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1229260684), +:last_modified => Time.at(1233498959), :references => [ -"InstallForInstantClient", "InstallForFullClient", ], :title => "\343\203\227\343\203\251\343\203\203\343\203\210\343\203\225\343\202\251\343\203\274\343\203\240\345\233\272\346\234\211\343\201\256\345\225\217\351\241\214", Modified: web/hiki_data/ja/text/PlatformSpecificIssue =================================================================== --- web/hiki_data/ja/text/PlatformSpecificIssue 2009-01-31 14:17:56 UTC (rev 311) +++ web/hiki_data/ja/text/PlatformSpecificIssue 2009-02-01 14:39:25 UTC (rev 312) @@ -1,12 +1,10 @@ ! Intel Mac -Oracle ? intel mac ???????????????? -[[Oracle Instant Client]] 10.1.0.3 ? ppc ????????intel CPU ?? ruby ?????????? (???????? Mac OS X ?? instant client ???????? [[??????|http://www.oracle.com/technology/tech/oci/instantclient/index.html]]??????) - -?????????????????? +Intel ? instant client ? Mac OS X 10.5 Leopard ???? +10.4 Tiger ?????????????????????? * ruby ? ppc ???????????([[Raimonds Simanovskis???blog|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]] ???) * [[ruby-odbc|http://www.ch-werner.de/rubyodbc/]]?????????ODBC????([[Actual Technologies|http://www.actualtechnologies.com/]] ??? [[OpenLink Software|http://uda.openlinksw.com/]])?????? @@ -42,18 +40,51 @@ # oracle8-client port ? Linux ?? Oracle 8.1.7.1 ??????????????????Oracle ? 8.1.7.1 ? Oracle 10g ???????????????????? # ?????????FreeBSD 7.0 ?? Oracle ?????????? Segmentation fault ??????ruby-oci8 ???????????????C??????????????????????? -oracle8-client port ?????????????????? -* oracle8-client ??????? +1. instantclient ? linux emulator ?? ruby ????? + +ruby-oci8 ? linux emulator ????????????????????????? +???????????????????????????? + +FreeBSD ? linux ??????????????????????????? +?????? ruby ? ruby-oci8 ?????????? + +FreeBSD ???????????????????FreeBSD ?????????? linux +???????????????????????????????????? linux ?? +ruby ? ruby-oci8 ???????? FreeBSD ??????????? + + on linux + # ruby ??? + tar xvfz ruby-1.8.x.tar.gz + cd ruby-1.8.x + ./configure --prefix=/usr/local/ruby-1.8.x --enable-pthread + make + make install + # instant client ??????? + .... + # ruby-oci8 ??? + PATH=/usr/local/ruby-1.8.x/bin:$PATH + tar xvfz ruby-oci8-1.0.x.tar.gz + cd ruby-oci8-1.0.x + make + make install + cd /usr/local/ + tar cvfz ruby-1.8.x-linux.tar.gz ruby-1.8.x + + ruby-1.8.x-linux.tar.gz ? FreeBSD ??????? + + on freebsd + cd /compat/linux/usr/local + tar xvfz ruby-1.8.x-linux.tar.gz + +2. oracle8-client port ???? + +??? oracle8-client port ??????????????????? +* install oracle8-client cd /usr/ports/databases/oracle8-client make make install * ???? ORACLE_HOME ??? export ORACLE_HOME=/usr/local/oracle8-client -* ruby-oci8 ???????????? oraconf.rb ??????? - tar xvfz ruby-oci8-1.0.0-rc3.tar.gz - cd ruby-oci8-1.0.0-rc3/ext/oci8 - mv oraconf.rb oraconf.rb.orig - wget http://ruby-oci8.rubyforge.org/svn/branches/ruby-oci8-1.0/ext/oci8/oraconf.rb ??????? [[InstallForFullClient]]???????? From nobody at rubyforge.org Sun Feb 1 10:05:35 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 1 Feb 2009 10:05:35 -0500 (EST) Subject: [ruby-oci8-commit] [313] branches/ruby-oci8-1.0/ChangeLog: * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. Message-ID: <20090201150535.CB9C018580F8@rubyforge.org> Revision: 313 Author: kubo Date: 2009-02-01 10:05:35 -0500 (Sun, 01 Feb 2009) Log Message: ----------- * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. * test/test_dbi.rb: suppress deprecated warnings while running test_bind_dbi_data_type. * test/test_dbi_clob.rb: fix a problem when running this file directly. Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2009-02-01 14:39:25 UTC (rev 312) +++ branches/ruby-oci8-1.0/ChangeLog 2009-02-01 15:05:35 UTC (rev 313) @@ -1,3 +1,10 @@ +2009-02-01 KUBO Takehiro + * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. + * test/test_dbi.rb: suppress deprecated warnings while running + test_bind_dbi_data_type. + * test/test_dbi_clob.rb: fix a problem when running this + file directly. + 2009-01-31 KUBO Takehiro * ext/oci8/oraconf.rb: fix for Oracle 11.1.0.7.0 instant client rpm package. The directory tree is a bit different From nobody at rubyforge.org Sun Feb 1 10:07:18 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 1 Feb 2009 10:07:18 -0500 (EST) Subject: [ruby-oci8-commit] [314] trunk/ruby-oci8: * lib/dbd/OCI8.rb: add code for ruby-dbi 0. 4 type conversion. Message-ID: <20090201150718.574D918580F5@rubyforge.org> Revision: 314 Author: kubo Date: 2009-02-01 10:07:17 -0500 (Sun, 01 Feb 2009) Log Message: ----------- * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. * test/test_dbi.rb: suppress deprecated warnings while running test_bind_dbi_data_type. * test/test_dbi_clob.rb: fix a problem when running this file directly. Modified Paths: -------------- branches/ruby-oci8-1.0/lib/dbd/OCI8.rb branches/ruby-oci8-1.0/test/test_dbi.rb branches/ruby-oci8-1.0/test/test_dbi_clob.rb trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/lib/dbd/OCI8.rb trunk/ruby-oci8/test/test_dbi.rb trunk/ruby-oci8/test/test_dbi_clob.rb Modified: branches/ruby-oci8-1.0/lib/dbd/OCI8.rb =================================================================== --- branches/ruby-oci8-1.0/lib/dbd/OCI8.rb 2009-02-01 15:05:35 UTC (rev 313) +++ branches/ruby-oci8-1.0/lib/dbd/OCI8.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -48,6 +48,27 @@ "OCI8" end +# type converstion handler to bind values. (ruby-dbi 0.4) +if DBI.const_defined?(:TypeUtil) + DBI::TypeUtil.register_conversion("OCI8") do |obj| + case obj + when ::TrueClass + ['1', false] + when ::FalseClass + ['0', false] + else + [obj, false] + end + end +end + +# no type converstion is required for result set. (ruby-dbi 0.4) +class NoTypeConversion + def self.parse(obj) + obj + end +end + module Util ERROR_MAP = { @@ -138,6 +159,7 @@ 'nullable' => col.nullable?, 'precision' => precision, 'scale' => scale, + 'dbi_type' => NoTypeConversion, } end private :column_metadata_to_column_info Modified: branches/ruby-oci8-1.0/test/test_dbi.rb =================================================================== --- branches/ruby-oci8-1.0/test/test_dbi.rb 2009-02-01 15:05:35 UTC (rev 313) +++ branches/ruby-oci8-1.0/test/test_dbi.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -146,17 +146,27 @@ end def test_bind_dbi_data_type - inval = DBI::Date.new(2004, 3, 20) - sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Date, inval) - outval = sth.func(:bind_value, 1) - assert_instance_of(DBI::Date, outval) - assert_equal(inval.to_time, outval.to_time) + begin + if DBI::VERSION >= '0.4.0' + # suppress deprecated warnings while running this test. + saved_action = Deprecated.action + Deprecated.set_action(Proc.new {}) + end - inval = DBI::Timestamp.new(2004, 3, 20, 18, 26, 33) - sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Timestamp, inval) - outval = sth.func(:bind_value, 1) - assert_instance_of(DBI::Timestamp, outval) - assert_equal(inval.to_time, outval.to_time) + inval = DBI::Date.new(2004, 3, 20) + sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Date, inval) + outval = sth.func(:bind_value, 1) + assert_instance_of(DBI::Date, outval) + assert_equal(inval.to_time, outval.to_time) + + inval = DBI::Timestamp.new(2004, 3, 20, 18, 26, 33) + sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Timestamp, inval) + outval = sth.func(:bind_value, 1) + assert_instance_of(DBI::Timestamp, outval) + assert_equal(inval.to_time, outval.to_time) + ensure + Deprecated.set_action(saved_action) if saved_action + end end def test_column_info Modified: branches/ruby-oci8-1.0/test/test_dbi_clob.rb =================================================================== --- branches/ruby-oci8-1.0/test/test_dbi_clob.rb 2009-02-01 15:05:35 UTC (rev 313) +++ branches/ruby-oci8-1.0/test/test_dbi_clob.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -54,5 +54,5 @@ end if $0 == __FILE__ - RUNIT::CUI::TestRunner.run(TestCLob.suite()) + RUNIT::CUI::TestRunner.run(TestDbiCLob.suite()) end Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-01 15:05:35 UTC (rev 313) +++ trunk/ruby-oci8/ChangeLog 2009-02-01 15:07:17 UTC (rev 314) @@ -1,3 +1,10 @@ +2009-02-01 KUBO Takehiro + * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. + * test/test_dbi.rb: suppress deprecated warnings while running + test_bind_dbi_data_type. + * test/test_dbi_clob.rb: fix a problem when running this + file directly. + 2009-01-31 KUBO Takehiro * ext/oci8/oraconf.rb: fix for Oracle 11.1.0.7.0 instant client rpm package. The directory tree is a bit different Modified: trunk/ruby-oci8/lib/dbd/OCI8.rb =================================================================== --- trunk/ruby-oci8/lib/dbd/OCI8.rb 2009-02-01 15:05:35 UTC (rev 313) +++ trunk/ruby-oci8/lib/dbd/OCI8.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -48,6 +48,27 @@ "OCI8" end +# type converstion handler to bind values. (ruby-dbi 0.4) +if DBI.const_defined?(:TypeUtil) + DBI::TypeUtil.register_conversion("OCI8") do |obj| + case obj + when ::TrueClass + ['1', false] + when ::FalseClass + ['0', false] + else + [obj, false] + end + end +end + +# no type converstion is required for result set. (ruby-dbi 0.4) +class NoTypeConversion + def self.parse(obj) + obj + end +end + module Util ERROR_MAP = { @@ -138,6 +159,7 @@ 'nullable' => col.nullable?, 'precision' => precision, 'scale' => scale, + 'dbi_type' => NoTypeConversion, } end private :column_metadata_to_column_info Modified: trunk/ruby-oci8/test/test_dbi.rb =================================================================== --- trunk/ruby-oci8/test/test_dbi.rb 2009-02-01 15:05:35 UTC (rev 313) +++ trunk/ruby-oci8/test/test_dbi.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -166,17 +166,27 @@ end def test_bind_dbi_data_type - inval = DBI::Date.new(2004, 3, 20) - sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Date, inval) - outval = sth.func(:bind_value, 1) - assert_instance_of(DBI::Date, outval) - assert_equal(inval.to_time, outval.to_time) + begin + if DBI::VERSION >= '0.4.0' + # suppress deprecated warnings while running this test. + saved_action = Deprecated.action + Deprecated.set_action(Proc.new {}) + end - inval = DBI::Timestamp.new(2004, 3, 20, 18, 26, 33) - sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Timestamp, inval) - outval = sth.func(:bind_value, 1) - assert_instance_of(DBI::Timestamp, outval) - assert_equal(inval.to_time, outval.to_time) + inval = DBI::Date.new(2004, 3, 20) + sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Date, inval) + outval = sth.func(:bind_value, 1) + assert_instance_of(DBI::Date, outval) + assert_equal(inval.to_time, outval.to_time) + + inval = DBI::Timestamp.new(2004, 3, 20, 18, 26, 33) + sth = @dbh.execute("BEGIN ? := ?; END;", DBI::Timestamp, inval) + outval = sth.func(:bind_value, 1) + assert_instance_of(DBI::Timestamp, outval) + assert_equal(inval.to_time, outval.to_time) + ensure + Deprecated.set_action(saved_action) if saved_action + end end def test_column_info Modified: trunk/ruby-oci8/test/test_dbi_clob.rb =================================================================== --- trunk/ruby-oci8/test/test_dbi_clob.rb 2009-02-01 15:05:35 UTC (rev 313) +++ trunk/ruby-oci8/test/test_dbi_clob.rb 2009-02-01 15:07:17 UTC (rev 314) @@ -1,4 +1,5 @@ require 'dbi' +require 'oci8' require 'test/unit' require File.dirname(__FILE__) + '/config' From nobody at rubyforge.org Fri Feb 6 07:53:35 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Fri, 6 Feb 2009 07:53:35 -0500 (EST) Subject: [ruby-oci8-commit] [315] trunk/ruby-oci8: * setup.rb: 1. Message-ID: <20090206125335.C4662185810A@rubyforge.org> Revision: 315 Author: kubo Date: 2009-02-06 07:53:35 -0500 (Fri, 06 Feb 2009) Log Message: ----------- * setup.rb: 1. install lib/**/*.yml flies also. (It is pointed by Nate Wiger that encoding.yml is not installed.) 2. exclude .svn or .git directories on installation. * lib/oci8/oci8.rb: A private method define_a_column was renamed to define_one_column to prevent activerecord oracle adapter and oracle enhanced adapter from redefining the method. * dist-files: add newly added file names which must be included in gem or tar.gz packages. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/dist-files trunk/ruby-oci8/lib/oci8/oci8.rb trunk/ruby-oci8/setup.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-01 15:07:17 UTC (rev 314) +++ trunk/ruby-oci8/ChangeLog 2009-02-06 12:53:35 UTC (rev 315) @@ -1,3 +1,13 @@ +2009-02-06 KUBO Takehiro + * setup.rb: 1. install lib/**/*.yml flies also. + (It is pointed by Nate Wiger that encoding.yml is not installed.) + 2. exclude .svn or .git directories on installation. + * lib/oci8/oci8.rb: A private method define_a_column was renamed + to define_one_column to prevent activerecord oracle adapter + and oracle enhanced adapter from redefining the method. + * dist-files: add newly added file names which must be included + in gem or tar.gz packages. + 2009-02-01 KUBO Takehiro * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. * test/test_dbi.rb: suppress deprecated warnings while running Modified: trunk/ruby-oci8/dist-files =================================================================== --- trunk/ruby-oci8/dist-files 2009-02-01 15:07:17 UTC (rev 314) +++ trunk/ruby-oci8/dist-files 2009-02-06 12:53:35 UTC (rev 315) @@ -37,13 +37,16 @@ ext/oci8/xmldb.c lib/.document lib/oci8.rb.in -lib/DBD/OCI8/OCI8.rb +lib/dbd/OCI8.rb lib/oci8/.document lib/oci8/compat.rb lib/oci8/datetime.rb +lib/oci8/encoding-init.rb +lib/oci8/encoding.yml lib/oci8/metadata.rb lib/oci8/object.rb lib/oci8/oci8.rb +lib/oci8/oracle_version.rb test/README test/config.rb test/test_all.rb @@ -58,6 +61,7 @@ test/test_dbi_clob.rb test/test_metadata.rb test/test_oci8.rb +test/test_oracle_version.rb test/test_oradate.rb test/test_oranumber.rb test/test_rowid.rb Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2009-02-01 15:07:17 UTC (rev 314) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2009-02-06 12:53:35 UTC (rev 315) @@ -529,15 +529,15 @@ num_cols = __param_count 1.upto(num_cols) do |i| parm = __paramGet(i) - define_a_column(i, parm) unless __defined?(i) + define_one_column(i, parm) unless __defined?(i) @column_metadata[i - 1] = parm end num_cols end # define_columns - def define_a_column(pos, param) + def define_one_column(pos, param) __define(pos, make_bind_object(param)) - end # define_a_column + end # define_one_column def bind_params(*bindvars) bindvars.each_with_index do |val, i| Modified: trunk/ruby-oci8/setup.rb =================================================================== --- trunk/ruby-oci8/setup.rb 2009-02-01 15:07:17 UTC (rev 314) +++ trunk/ruby-oci8/setup.rb 2009-02-06 12:53:35 UTC (rev 315) @@ -495,7 +495,7 @@ end REJECT_DIRS = %w( - CVS SCCS RCS CVS.adm + CVS SCCS RCS CVS.adm .svn .git ) def all_dirs_in(dirname) @@ -1163,7 +1163,7 @@ end def ruby_scripts - collect_filenames_auto().select {|n| /\.rb\z/ =~ n } + collect_filenames_auto().select {|n| /\.(rb|yml)\z/ =~ n } end # picked up many entries from cvs-1.11.1/src/ignore.c From nobody at rubyforge.org Sun Feb 8 04:27:13 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 8 Feb 2009 04:27:13 -0500 (EST) Subject: [ruby-oci8-commit] [316] branches/ruby-oci8-1.0: * NEWS: add changes between 1.0.3 and 1.0.4. Message-ID: <20090208092713.57EF41858101@rubyforge.org> Revision: 316 Author: kubo Date: 2009-02-08 04:27:09 -0500 (Sun, 08 Feb 2009) Log Message: ----------- * NEWS: add changes between 1.0.3 and 1.0.4. * VERSION: change version to 1.0.4. * dist-files: add newly added file names which must be included in gem or tar.gz packages. Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog branches/ruby-oci8-1.0/NEWS branches/ruby-oci8-1.0/VERSION branches/ruby-oci8-1.0/dist-files Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2009-02-06 12:53:35 UTC (rev 315) +++ branches/ruby-oci8-1.0/ChangeLog 2009-02-08 09:27:09 UTC (rev 316) @@ -1,3 +1,9 @@ +2009-02-08 KUBO Takehiro + * NEWS: add changes between 1.0.3 and 1.0.4. + * VERSION: change version to 1.0.4. + * dist-files: add newly added file names which must be included + in gem or tar.gz packages. + 2009-02-01 KUBO Takehiro * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. * test/test_dbi.rb: suppress deprecated warnings while running Modified: branches/ruby-oci8-1.0/NEWS =================================================================== --- branches/ruby-oci8-1.0/NEWS 2009-02-06 12:53:35 UTC (rev 315) +++ branches/ruby-oci8-1.0/NEWS 2009-02-08 09:27:09 UTC (rev 316) @@ -1,3 +1,41 @@ +1.0.4: + +1. [dbi] support ruby-dbi 0.4 + (Thanks to James Cao and Peter Zingg.) + + Ruby-dbi 0.4 is supported by DBD::OCI8 after 6 months from the + release of 0.4. + + If you are using ruby-dbi 0.1.1, you need to copy dbd/OCI8.rb + to DBD/OCI8/OCI8.rb. The file itself works fine with ruby-dbi + 0.1.1, but the dbi cannot find the file by default. + +2. Rowid column data are fetched as a String by default. + +3. The return type of OCI8::Cursor#rowid is changed from OCIRowid + to String. + + Note: It needs one network roundtrip to convert OCIRowid to + String on server side when using Oracle 8.x client. + On Oracle 9.0 or upper it is converted in the client side. + +4. An exception is raised if a connection is used in a process which is + different with a process to establish the connection. + + If you encounter an exception "The connection cannot be reused in the + forked process," see the following link. + + http://groups.google.com/group/phusion-passenger/browse_thread/thread/b00d4770bc1d00b8 + +5. fix for 11.1.0.7.0 instant rpm package. + (reported by Luis Parravicini.) + + The directory tree is a bit different with that of 11.1.0.6.0 + or earlier. + +6. suppress compilation warnings. + (contributed by Daniel Berger) + 1.0.3: 1. add workaround code for a losing character problem when reading CLOB. Modified: branches/ruby-oci8-1.0/VERSION =================================================================== --- branches/ruby-oci8-1.0/VERSION 2009-02-06 12:53:35 UTC (rev 315) +++ branches/ruby-oci8-1.0/VERSION 2009-02-08 09:27:09 UTC (rev 316) @@ -1 +1 @@ -1.0.3 \ No newline at end of file +1.0.4 \ No newline at end of file Modified: branches/ruby-oci8-1.0/dist-files =================================================================== --- branches/ruby-oci8-1.0/dist-files 2009-02-06 12:53:35 UTC (rev 315) +++ branches/ruby-oci8-1.0/dist-files 2009-02-08 09:27:09 UTC (rev 316) @@ -39,7 +39,7 @@ ext/oci8/stmt.c ext/oci8/svcctx.c lib/oci8.rb.in -lib/DBD/OCI8/OCI8.rb +lib/dbd/OCI8.rb support/README support/runit/assert.rb support/runit/cui/testrunner.rb @@ -68,3 +68,4 @@ test/test_oradate.rb test/test_oranumber.rb test/test_metadata.rb +test/test_rowid.rb From nobody at rubyforge.org Sun Feb 8 04:45:10 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 8 Feb 2009 04:45:10 -0500 (EST) Subject: [ruby-oci8-commit] [317] branches/ruby-oci8-1.0: * metaconfig: follow the change of dbd/OCI8. rb location. Message-ID: <20090208094510.B3E1E185810A@rubyforge.org> Revision: 317 Author: kubo Date: 2009-02-08 04:45:10 -0500 (Sun, 08 Feb 2009) Log Message: ----------- * metaconfig: follow the change of dbd/OCI8.rb location. Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog branches/ruby-oci8-1.0/metaconfig Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2009-02-08 09:27:09 UTC (rev 316) +++ branches/ruby-oci8-1.0/ChangeLog 2009-02-08 09:45:10 UTC (rev 317) @@ -3,6 +3,7 @@ * VERSION: change version to 1.0.4. * dist-files: add newly added file names which must be included in gem or tar.gz packages. + * metaconfig: follow the change of dbd/OCI8.rb location. 2009-02-01 KUBO Takehiro * lib/dbd/OCI8.rb: add code for ruby-dbi 0.4 type conversion. Modified: branches/ruby-oci8-1.0/metaconfig =================================================================== --- branches/ruby-oci8-1.0/metaconfig 2009-02-08 09:27:09 UTC (rev 316) +++ branches/ruby-oci8-1.0/metaconfig 2009-02-08 09:45:10 UTC (rev 317) @@ -120,8 +120,8 @@ install_files['oci8.rb'] = <<-EOS #{get_zcontent('lib/oci8.rb')}EOS -install_files['DBD/OCI8/OCI8.rb'] = <<-EOS -#{get_zcontent('lib/DBD/OCI8/OCI8.rb')}EOS +install_files['dbd/OCI8.rb'] = <<-EOS +#{get_zcontent('lib/dbd/OCI8.rb')}EOS begin installer = Installer.new(install_files) From nobody at rubyforge.org Sun Feb 8 07:35:37 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 8 Feb 2009 07:35:37 -0500 (EST) Subject: [ruby-oci8-commit] [318] trunk/ruby-oci8: * VERSION: change version from 2.0-svn to 2.0. 0 to pass ruby Message-ID: <20090208123537.2A6B818580F0@rubyforge.org> Revision: 318 Author: kubo Date: 2009-02-08 07:35:36 -0500 (Sun, 08 Feb 2009) Log Message: ----------- * VERSION: change version from 2.0-svn to 2.0.0 to pass ruby gem's version string validator. * ruby-oci8.gemspec: added. * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/oci8lib.c, ext/oci8/win32.c: 1. add OCI8::Win32Util.dll_path to retrieve Oracle home location from the OCI.DLL location. 2. add OCI8::Win32Util.enum_homes to get Oracle home and NLS_LANG pairs in Windows registry. * lib/oci8/encoding-init.rb: get NLS_LANG from Windows registry if environment variable NLS_LANG is not set. * ext/oci8/oraconf.rb: Change the output encoding of sqlplus to US7ASCII by setting NLS_LANG. If the output encoding is incompatible with the default external encoding, it raises 'invalid byte sequence' when using ruby 1.9. * lib/oci8/datetime.rb: fix for ruby 1.9. Ruby 1.9 Time class's resolution is nanosecond. * dist-files: add dist-files, ruby-oci8.gemspec and ext/oci8/win32.c. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/VERSION trunk/ruby-oci8/dist-files trunk/ruby-oci8/ext/oci8/extconf.rb trunk/ruby-oci8/ext/oci8/oci8.h trunk/ruby-oci8/ext/oci8/oci8lib.c trunk/ruby-oci8/ext/oci8/oraconf.rb trunk/ruby-oci8/lib/oci8/datetime.rb trunk/ruby-oci8/lib/oci8/encoding-init.rb Added Paths: ----------- trunk/ruby-oci8/ext/oci8/win32.c trunk/ruby-oci8/ruby-oci8.gemspec Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/ChangeLog 2009-02-08 12:35:36 UTC (rev 318) @@ -1,3 +1,22 @@ +2009-02-08 KUBO Takehiro + * VERSION: change version from 2.0-svn to 2.0.0 to pass ruby + gem's version string validator. + * ruby-oci8.gemspec: added. + * ext/oci8/extconf.rb, ext/oci8/oci8.h, ext/oci8/oci8lib.c, + ext/oci8/win32.c: 1. add OCI8::Win32Util.dll_path to + retrieve Oracle home location from the OCI.DLL location. + 2. add OCI8::Win32Util.enum_homes to get Oracle home and + NLS_LANG pairs in Windows registry. + * lib/oci8/encoding-init.rb: get NLS_LANG from Windows registry + if environment variable NLS_LANG is not set. + * ext/oci8/oraconf.rb: Change the output encoding of sqlplus to + US7ASCII by setting NLS_LANG. If the output encoding is + incompatible with the default external encoding, it raises + 'invalid byte sequence' when using ruby 1.9. + * lib/oci8/datetime.rb: fix for ruby 1.9. Ruby 1.9 Time + class's resolution is nanosecond. + * dist-files: add dist-files, ruby-oci8.gemspec and ext/oci8/win32.c. + 2009-02-06 KUBO Takehiro * setup.rb: 1. install lib/**/*.yml flies also. (It is pointed by Nate Wiger that encoding.yml is not installed.) Modified: trunk/ruby-oci8/VERSION =================================================================== --- trunk/ruby-oci8/VERSION 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/VERSION 2009-02-08 12:35:36 UTC (rev 318) @@ -1 +1 @@ -2.0-svn +2.0.0 Modified: trunk/ruby-oci8/dist-files =================================================================== --- trunk/ruby-oci8/dist-files 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/dist-files 2009-02-08 12:35:36 UTC (rev 318) @@ -2,8 +2,10 @@ Makefile README VERSION +dist-files metaconfig pre-distclean.rb +ruby-oci8.gemspec setup.rb doc/api.en.html doc/api.en.rd @@ -34,6 +36,7 @@ ext/oci8/post-config.rb ext/oci8/stmt.c ext/oci8/object.c +ext/oci8/win32.c ext/oci8/xmldb.c lib/.document lib/oci8.rb.in Modified: trunk/ruby-oci8/ext/oci8/extconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/extconf.rb 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/ext/oci8/extconf.rb 2009-02-08 12:35:36 UTC (rev 318) @@ -81,6 +81,11 @@ "ocinumber.o", "ocidatetime.o", "object.o", "apiwrap.o", "encoding.o", "xmldb.o"] +if RUBY_PLATFORM =~ /mswin32|cygwin|mingw32|bccwin32/ + $defs << "-DUSE_WIN32_C" + $objs << "win32.o" +end + # Checking gcc or not if oraconf.cc_is_gcc $CFLAGS += " -Wall" Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2009-02-08 12:35:36 UTC (rev 318) @@ -436,6 +436,9 @@ void Init_oci8_encoding(VALUE cOCI8); VALUE oci8_charset_id2name(VALUE svc, VALUE charset_id); +/* win32.c */ +void Init_oci8_win32(VALUE cOCI8); + #ifdef HAVE_TYPE_RB_ENCODING extern rb_encoding *oci8_encoding; Modified: trunk/ruby-oci8/ext/oci8/oci8lib.c =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8lib.c 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/ext/oci8/oci8lib.c 2009-02-08 12:35:36 UTC (rev 318) @@ -160,6 +160,10 @@ Init_oci_object(cOCI8); Init_oci_xmldb(); +#ifdef USE_WIN32_C + Init_oci8_win32(cOCI8); +#endif + #ifdef DEBUG_CORE_FILE signal(SIGSEGV, SIG_DFL); #endif Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/oraconf.rb 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/ext/oci8/oraconf.rb 2009-02-08 12:35:36 UTC (rev 318) @@ -712,6 +712,7 @@ sqlplus = "sqlplus" end Logging::open do + ENV['NLS_LANG'] = 'american_america.us7ascii' open("|#{@oracle_home}/bin/#{sqlplus} < #{dev_null}") do |f| while line = f.gets print line Added: trunk/ruby-oci8/ext/oci8/win32.c =================================================================== --- trunk/ruby-oci8/ext/oci8/win32.c (rev 0) +++ trunk/ruby-oci8/ext/oci8/win32.c 2009-02-08 12:35:36 UTC (rev 318) @@ -0,0 +1,131 @@ +/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */ +/* + win32.c - part of ruby-oci8 + + Copyright (C) 2009 KUBO Takehiro +*/ +#include "oci8.h" +#include + +NORETURN(static void raise_error(void)); + +static void raise_error(void) +{ + char msg[1024]; + int err = GetLastError(); + char *p; + + sprintf(msg, "%d: ", err); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + msg + strlen(msg), sizeof(msg) - strlen(msg), NULL); + for (p = msg; *p != '\0'; p++) { + if (*p == '\n' || *p == '\r') { + *p = ' '; + } + } + rb_raise(rb_eRuntimeError, "%s", msg); +} + +static VALUE dll_path(VALUE module) +{ + HMODULE hModule; + DWORD len; + char path[1024]; + + hModule = GetModuleHandle("OCI.DLL"); + if (hModule == NULL) { + raise_error(); + } + len = GetModuleFileName(hModule, path, sizeof(path)); + if (len == 0) { + raise_error(); + } + return rb_external_str_new_with_enc(path, len, rb_filesystem_encoding()); +} + + +typedef struct { + HKEY hKey; + HKEY hSubKey; +} enum_homes_arg_t; + +static VALUE enum_homes_real(enum_homes_arg_t *arg) +{ + LONG rv; + DWORD type; + DWORD idx; + char name[1024]; + DWORD name_len; + FILETIME ft; + + rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\ORACLE", 0, KEY_ENUMERATE_SUB_KEYS, &arg->hKey); + if (rv != ERROR_SUCCESS) { + return Qnil; + } + for (idx = 0; ; idx++) { + volatile VALUE oracle_home; + volatile VALUE nls_lang; + + /* Get subkey name */ + name_len = sizeof(name); + rv = RegEnumKeyEx(arg->hKey, idx, name, &name_len, NULL, NULL, NULL, &ft); + if (rv != ERROR_SUCCESS) { + break; + } + /* Open subkey */ + if (arg->hSubKey != NULL) { + RegCloseKey(arg->hSubKey); + arg->hSubKey = NULL; + } + rv = RegOpenKeyEx(arg->hKey, name, 0, KEY_QUERY_VALUE, &arg->hSubKey); + if (rv != ERROR_SUCCESS) { + continue; + } + /* Get ORACLE_HOME */ + name_len = sizeof(name); + rv = RegQueryValueEx(arg->hSubKey, "ORACLE_HOME", NULL, &type, name, &name_len); + if (rv != ERROR_SUCCESS || type != REG_SZ) { + continue; + } + oracle_home = rb_locale_str_new_cstr(name); + /* Get NLS_LANG */ + name_len = sizeof(name); + rv = RegQueryValueEx(arg->hSubKey, "NLS_LANG", NULL, &type, name, &name_len); + if (rv != ERROR_SUCCESS || type != REG_SZ) { + continue; + } + nls_lang = rb_locale_str_new_cstr(name); + rb_yield_values(2, oracle_home, nls_lang); + } + return Qnil; +} + +static VALUE enum_homes_ensure(enum_homes_arg_t *arg) +{ + if (arg->hKey != NULL) { + RegCloseKey(arg->hKey); + arg->hKey = NULL; + } + if (arg->hSubKey != NULL) { + RegCloseKey(arg->hSubKey); + arg->hSubKey = NULL; + } + return Qnil; +} + +static VALUE enum_homes(VALUE module) +{ + enum_homes_arg_t arg; + arg.hKey = NULL; + arg.hSubKey = NULL; + return rb_ensure(enum_homes_real, (VALUE)&arg, enum_homes_ensure, (VALUE)&arg); +} + +void Init_oci8_win32(VALUE cOCI8) +{ + VALUE mWin32Util = rb_define_module_under(cOCI8, "Win32Util"); + + rb_define_module_function(mWin32Util, "dll_path", dll_path, 0); + rb_define_module_function(mWin32Util, "enum_homes", enum_homes, 0); +} Modified: trunk/ruby-oci8/lib/oci8/datetime.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/datetime.rb 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/lib/oci8/datetime.rb 2009-02-08 12:35:36 UTC (rev 318) @@ -151,7 +151,10 @@ end if timezone begin - return ::Time.send(timezone, year, month, day, hour, minute, sec, fsec / 1000) + # Ruby 1.9 Time class's resolution is nanosecond. + # But the last argument type is millisecond. + # 'fsec' is converted to a Float to pass sub-millisecond part. + return ::Time.send(timezone, year, month, day, hour, minute, sec, fsec / 1000.0) rescue StandardError end end Modified: trunk/ruby-oci8/lib/oci8/encoding-init.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/encoding-init.rb 2009-02-08 09:45:10 UTC (rev 317) +++ trunk/ruby-oci8/lib/oci8/encoding-init.rb 2009-02-08 12:35:36 UTC (rev 318) @@ -5,8 +5,17 @@ # try to get NLS_LANG. nls_lang = ENV['NLS_LANG'] -if nls_lang.nil? and RUBY_PLATFORM =~ /mswin32|cygwin|mingw32|bccwin32/ - # TODO +if defined? OCI8::Win32Util + dll_path = OCI8::Win32Util.dll_path.upcase + if dll_path =~ %r{\\BIN\\OCI.DLL} + oracle_home = $` + OCI8::Win32Util.enum_homes do |home, lang| + if oracle_home == home.upcase + nls_lang = lang + break + end + end + end end if nls_lang Added: trunk/ruby-oci8/ruby-oci8.gemspec =================================================================== --- trunk/ruby-oci8/ruby-oci8.gemspec (rev 0) +++ trunk/ruby-oci8/ruby-oci8.gemspec 2009-02-08 12:35:36 UTC (rev 318) @@ -0,0 +1,54 @@ +# -*- ruby -*- +# +# To make a pure ruby gems package: +# gem build ruby-oci8.gemspec +# +# To make a binary gems package: +# gem build ruby-oci8.gemspec -- current +# + +if ARGV.size > 3 + gem_platform = ARGV[3] +else + gem_platform = Gem::Platform::RUBY +end + +spec = Gem::Specification.new do |s| + s.name = 'ruby-oci8' + s.version = File.read('VERSION').strip + s.summary = 'Ruby interface for Oracle using OCI8 API' + s.email = 'kubo at jiubao.org' + s.homepage = 'http://ruby-oci8.rubyforge.org' + s.rubyforge_project = 'ruby-oci8' + s.description = < Revision: 319 Author: kubo Date: 2009-02-08 08:28:56 -0500 (Sun, 08 Feb 2009) Log Message: ----------- * hiki_data/(en|ja)/text/PlatformSpecificIssue: update Mac OS X information. * hiki_data/(en|ja)/text/FrontPage: delete notice that ruby-oci8 doen't work with ruby-dbi 0.4. * hiki_data/en/text/News2_0, hiki_data/en/text/SideMenu: add 'News in 2.0.' Modified Paths: -------------- web/ChangeLog web/hiki_data/en/info.db web/hiki_data/en/text/FrontPage web/hiki_data/en/text/PlatformSpecificIssue web/hiki_data/en/text/SideMenu web/hiki_data/ja/info.db web/hiki_data/ja/text/FrontPage web/hiki_data/ja/text/PlatformSpecificIssue Modified: web/ChangeLog =================================================================== --- web/ChangeLog 2009-02-08 12:35:36 UTC (rev 318) +++ web/ChangeLog 2009-02-08 13:28:56 UTC (rev 319) @@ -1,3 +1,11 @@ +2009-02-08 KUBO Takehiro + * hiki_data/(en|ja)/text/PlatformSpecificIssue: + update Mac OS X information. + * hiki_data/(en|ja)/text/FrontPage: + delete notice that ruby-oci8 doen't work with ruby-dbi 0.4. + * hiki_data/en/text/News2_0, hiki_data/en/text/SideMenu: + add 'News in 2.0.' + 2009-02-01 KUBO Takehiro * hiki_data/en/text/PlatformSpecificIssue, hiki_data/ja/text/PlatformSpecificIssue update Mac OS X and FreeBSD information. Modified: web/hiki_data/en/info.db =================================================================== --- web/hiki_data/en/info.db 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/en/info.db 2009-02-08 13:28:56 UTC (rev 319) @@ -64,7 +64,7 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1229180402), +:last_modified => Time.at(1234098068), :references => [ "InstallForInstantClient", ], @@ -130,13 +130,24 @@ ], :title => "InterWikiName", }, +"News2_0" => { +:count => 0, +:editor => nil, +:freeze => false, +:keyword => [ +], +:last_modified => Time.at(1234099345), +:references => [ +], +:title => "News in 2.0", +}, "PlatformSpecificIssue" => { :count => 60, :editor => nil, :freeze => false, :keyword => [ ], -:last_modified => Time.at(1233498784), +:last_modified => Time.at(1234097653), :references => [ "InstallForFullClient", ], @@ -160,9 +171,10 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1224421827), +:last_modified => Time.at(1234098412), :references => [ "FrontPage", +"News2_0", "HowToInstall", "InstallBinaryPackage", "InstallForFullClient", Modified: web/hiki_data/en/text/FrontPage =================================================================== --- web/hiki_data/en/text/FrontPage 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/en/text/FrontPage 2009-02-08 13:28:56 UTC (rev 319) @@ -7,8 +7,6 @@ As for Oracle7, use [[Oracle7 Module for Ruby]] by Yoshida Masato. -'''NOTICE -- ruby-oci8 doesn't work with ruby-dbi 0.4.x. ruby-oci8 supports ruby-dbi 0.2.2 or lower.''' - ! Sample one-liner connect to scott/tiger, select emp and print as CSV format. ruby -r oci8 -e "OCI8.new('scott', 'tiger').exec('select * from emp') do |r| puts r.join(','); end" Modified: web/hiki_data/en/text/PlatformSpecificIssue =================================================================== --- web/hiki_data/en/text/PlatformSpecificIssue 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/en/text/PlatformSpecificIssue 2009-02-08 13:28:56 UTC (rev 319) @@ -1,9 +1,16 @@ -! Intel Mac +! Mac OS X -The Intel Instant client needs Mac OS X 10.5 Leopard. -There are two workarounds to work on 10.4 Tiger. -# compile ruby as ppc. (look at [[Raimonds Simanovskis's blog|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]]) +You need to delete '-arch ppc' or '-arch i386' in rbconfig.rb because +the ruby distributed with Mac is universal binary but the Oracle instant +client is not. +See: [[How to setup Ruby and new Oracle Instant Client on Leopard|http://blog.rayapps.com/2008/04/24/how-to-setup-ruby-and-new-oracle-instant-client-on-leopard/]]. +(PowerPC mac users need to swap ppc and i386 in the blog.) + +The Intel Instant client is for Mac OS X 10.5 Leopard. If you are using 10.4 Tiger, +use one of the following workarounds. +# compile ruby as ppc. (look at [[How to setup Ruby and Oracle client on Intel Mac|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]]) # use [[ruby-odbc|http://www.ch-werner.de/rubyodbc/]] and a third party ODBC driver ([[Actual Technologies|http://www.actualtechnologies.com/]] or [[OpenLink Software|http://uda.openlinksw.com/]]). +# use JRuby and Oracle JDBC driver. ! Solaris Modified: web/hiki_data/en/text/SideMenu =================================================================== --- web/hiki_data/en/text/SideMenu 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/en/text/SideMenu 2009-02-08 13:28:56 UTC (rev 319) @@ -8,6 +8,9 @@ !! [[FrontPage]] +!! News +* [[News2_0]] + !! Install and Setup * [[HowToInstall]] ** [[InstallBinaryPackage]] Modified: web/hiki_data/ja/info.db =================================================================== --- web/hiki_data/ja/info.db 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/ja/info.db 2009-02-08 13:28:56 UTC (rev 319) @@ -63,7 +63,7 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1229179773), +:last_modified => Time.at(1234098048), :references => [ "InstallForInstantClient", ], @@ -135,7 +135,7 @@ :freeze => false, :keyword => [ ], -:last_modified => Time.at(1233498959), +:last_modified => Time.at(1234097682), :references => [ "InstallForFullClient", ], Modified: web/hiki_data/ja/text/FrontPage =================================================================== --- web/hiki_data/ja/text/FrontPage 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/ja/text/FrontPage 2009-02-08 13:28:56 UTC (rev 319) @@ -7,8 +7,6 @@ Oracle7 ??????????????????[[Oracle7 Module for Ruby]]????????? -'''??: ruby-oci8 ? ruby-dbi 0.4.x ??????????????dbd ?????? ruby-dbi 0.2.2 ??????????''' - ! One-liner ????? scott/tiger ??????emp ????? select ???CSV ???????? Modified: web/hiki_data/ja/text/PlatformSpecificIssue =================================================================== --- web/hiki_data/ja/text/PlatformSpecificIssue 2009-02-08 12:35:36 UTC (rev 318) +++ web/hiki_data/ja/text/PlatformSpecificIssue 2009-02-08 13:28:56 UTC (rev 319) @@ -1,12 +1,19 @@ -! Intel Mac +! Mac OS X (???????? Mac OS X ?? instant client ???????? [[??????|http://www.oracle.com/technology/tech/oci/instantclient/index.html]]??????) -Intel ? instant client ? Mac OS X 10.5 Leopard ???? -10.4 Tiger ?????????????????????? -* ruby ? ppc ???????????([[Raimonds Simanovskis???blog|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]] ???) +rbconfig.rb ?? '-arch ppc' ????'-arch i386' ?????????? +??????Mac ??? ruby ? Universal binary ????Oracle instant +client ? Universal binary ????????? +[[How to setup Ruby and new Oracle Instant Client on Leopard|http://blog.rayapps.com/2008/04/24/how-to-setup-ruby-and-new-oracle-instant-client-on-leopard/]] ???????? +(PowerPC mac ???????????? ppc ? i386 ???????????) + +Intel ?? Instant client ? Mac OS X 10.5 Leopard ????10.4 Tiger ??? +???????????????????????????? +# ruby ? ppc ???????????([[How to setup Ruby and Oracle client on Intel Mac|http://blog.rayapps.com/2007/08/27/how-to-setup-ruby-and-oracle-client-on-intel-mac/]] ???) * [[ruby-odbc|http://www.ch-werner.de/rubyodbc/]]?????????ODBC????([[Actual Technologies|http://www.actualtechnologies.com/]] ??? [[OpenLink Software|http://uda.openlinksw.com/]])?????? +# JRuby ? Oracle JDBC driver ?????? ! Solaris From nobody at rubyforge.org Tue Feb 10 08:50:41 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 10 Feb 2009 08:50:41 -0500 (EST) Subject: [ruby-oci8-commit] [320] trunk/ruby-oci8: * ext/oci8/bind.c, ext/oci8/oci8.h, ext/oci8/stmt.c: fix array DML Message-ID: <20090210135041.4EA04167821A@rubyforge.org> Revision: 320 Author: kubo Date: 2009-02-10 08:50:40 -0500 (Tue, 10 Feb 2009) Log Message: ----------- * ext/oci8/bind.c, ext/oci8/oci8.h, ext/oci8/stmt.c: fix array DML and DateTime object problem. It didn't work with bind classes which overwrite 'set' and 'get'. (Reported by Leo?\197?\161 Bitto) * test/test_array_dml.rb: fix to test array DML and DateTime object. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/bind.c trunk/ruby-oci8/ext/oci8/oci8.h trunk/ruby-oci8/ext/oci8/stmt.c trunk/ruby-oci8/test/test_array_dml.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-08 13:28:56 UTC (rev 319) +++ trunk/ruby-oci8/ChangeLog 2009-02-10 13:50:40 UTC (rev 320) @@ -1,3 +1,9 @@ +2009-02-10 KUBO Takehiro + * ext/oci8/bind.c, ext/oci8/oci8.h, ext/oci8/stmt.c: fix array DML + and DateTime object problem. It didn't work with bind classes + which overwrite 'set' and 'get'. (Reported by Leo? Bitto) + * test/test_array_dml.rb: fix to test array DML and DateTime object. + 2009-02-08 KUBO Takehiro * VERSION: change version from 2.0-svn to 2.0.0 to pass ruby gem's version string validator. Modified: trunk/ruby-oci8/ext/oci8/bind.c =================================================================== --- trunk/ruby-oci8/ext/oci8/bind.c 2009-02-08 13:28:56 UTC (rev 319) +++ trunk/ruby-oci8/ext/oci8/bind.c 2009-02-10 13:50:40 UTC (rev 320) @@ -10,7 +10,6 @@ #include "oci8.h" static ID id_bind_type; -static ID id_set; static VALUE cOCI8BindTypeBase; @@ -330,8 +329,11 @@ SQLT_BDOUBLE }; -static inline VALUE oci8_get_data_at(const oci8_bind_class_t *obc, oci8_bind_t *obind, ub4 idx) +static VALUE oci8_bind_get(VALUE self) { + oci8_bind_t *obind = DATA_PTR(self); + const oci8_bind_class_t *obc = (const oci8_bind_class_t *)obind->base.klass; + ub4 idx = obind->curar_idx; void **null_structp = NULL; if (NIL_P(obind->tdo)) { @@ -345,26 +347,30 @@ return obc->get(obind, (void*)((size_t)obind->valuep + obind->alloc_sz * idx), null_structp); } -static VALUE oci8_get_data(VALUE self) +VALUE oci8_bind_get_data(VALUE self) { oci8_bind_t *obind = DATA_PTR(self); - const oci8_bind_class_t *obc = (const oci8_bind_class_t *)obind->base.klass; if (obind->maxar_sz == 0) { - return oci8_get_data_at(obc, obind, 0); + obind->curar_idx = 0; + return rb_funcall(self, oci8_id_get, 0); } else { volatile VALUE ary = rb_ary_new2(obind->curar_sz); ub4 idx; for (idx = 0; idx < obind->curar_sz; idx++) { - rb_ary_store(ary, idx, oci8_get_data_at(obc, obind, idx)); + obind->curar_idx = idx; + rb_ary_store(ary, idx, rb_funcall(self, oci8_id_get, 0)); } return ary; } } -static inline void oci8_set_data_at(const oci8_bind_class_t *obc, oci8_bind_t *obind, ub4 idx, VALUE val) +static VALUE oci8_bind_set(VALUE self, VALUE val) { + oci8_bind_t *obind = DATA_PTR(self); + const oci8_bind_class_t *obc = (const oci8_bind_class_t *)obind->base.klass; + ub4 idx = obind->curar_idx; if (NIL_P(val)) { if (NIL_P(obind->tdo)) { @@ -383,15 +389,16 @@ } obc->set(obind, (void*)((size_t)obind->valuep + obind->alloc_sz * idx), null_structp, val); } + return self; } -static VALUE oci8_set_data(VALUE self, VALUE val) +void oci8_bind_set_data(VALUE self, VALUE val) { oci8_bind_t *obind = DATA_PTR(self); - const oci8_bind_class_t *obc = (const oci8_bind_class_t *)obind->base.klass; if (obind->maxar_sz == 0) { - oci8_set_data_at(obc, obind, 0, val); + obind->curar_idx = 0; + rb_funcall(self, oci8_id_set, 1, val); } else { ub4 size; ub4 idx; @@ -402,11 +409,11 @@ rb_raise(rb_eRuntimeError, "over the max array size"); } for (idx = 0; idx < size; idx++) { - oci8_set_data_at(obc, obind, idx, RARRAY_PTR(val)[idx]); + obind->curar_idx = idx; + rb_funcall(self, oci8_id_set, 1, RARRAY_PTR(val)[idx]); } obind->curar_sz = size; } - return self; } static VALUE oci8_bind_initialize(VALUE self, VALUE svc, VALUE val, VALUE length, VALUE max_array_size) @@ -438,7 +445,7 @@ bind_class->init_elem(obind, svc); } if (!NIL_P(val)) { - rb_funcall(self, id_set, 1, val); + oci8_bind_set_data(self, val); } return Qnil; } @@ -474,11 +481,10 @@ { cOCI8BindTypeBase = klass; id_bind_type = rb_intern("bind_type"); - id_set = rb_intern("set"); rb_define_method(cOCI8BindTypeBase, "initialize", oci8_bind_initialize, 4); - rb_define_method(cOCI8BindTypeBase, "get", oci8_get_data, 0); - rb_define_method(cOCI8BindTypeBase, "set", oci8_set_data, 1); + rb_define_method(cOCI8BindTypeBase, "get", oci8_bind_get, 0); + rb_define_method(cOCI8BindTypeBase, "set", oci8_bind_set, 1); /* register primitive data types. */ oci8_define_bind_class("String", &bind_string_class); Modified: trunk/ruby-oci8/ext/oci8/oci8.h =================================================================== --- trunk/ruby-oci8/ext/oci8/oci8.h 2009-02-08 13:28:56 UTC (rev 319) +++ trunk/ruby-oci8/ext/oci8/oci8.h 2009-02-10 13:50:40 UTC (rev 320) @@ -241,6 +241,7 @@ sb4 alloc_sz; /* size of a element. */ ub4 maxar_sz; /* maximum array size. */ ub4 curar_sz; /* current array size. */ + ub4 curar_idx;/* current array index. */ VALUE tdo; union { void **null_structs; @@ -375,6 +376,8 @@ void oci8_bind_hp_obj_mark(oci8_base_t *base); void Init_oci8_bind(VALUE cOCI8BindTypeBase); oci8_bind_t *oci8_get_bind(VALUE obj); +void oci8_bind_set_data(VALUE self, VALUE val); +VALUE oci8_bind_get_data(VALUE self); /* metadata.c */ extern VALUE cOCI8MetadataBase; Modified: trunk/ruby-oci8/ext/oci8/stmt.c =================================================================== --- trunk/ruby-oci8/ext/oci8/stmt.c 2009-02-08 13:28:56 UTC (rev 319) +++ trunk/ruby-oci8/ext/oci8/stmt.c 2009-02-10 13:50:40 UTC (rev 320) @@ -25,7 +25,6 @@ static ID id_empty_p; static ID id_at_con; static ID id_clear; -static ID id_set; VALUE cOCIStmt; @@ -428,7 +427,7 @@ #endif /* USE_DYNAMIC_FETCH */ ary = rb_ary_new2(RARRAY_LEN(stmt->defns)); for (idx = 0; idx < RARRAY_LEN(stmt->defns); idx++) { - rb_ary_store(ary, idx, rb_funcall(RARRAY_PTR(stmt->defns)[idx], oci8_id_get, 0)); + rb_ary_store(ary, idx, oci8_bind_get_data(RARRAY_PTR(stmt->defns)[idx])); } return ary; } @@ -599,7 +598,7 @@ if (NIL_P(obj)) { return Qnil; } - return rb_funcall(obj, oci8_id_get, 0); + return oci8_bind_get_data(obj); } /* @@ -650,8 +649,8 @@ rb_ivar_set(self, id_at_actual_array_size, INT2NUM(bind_array_size)); } } - - return rb_funcall(obj, oci8_id_set, 1, val); + oci8_bind_set_data(obj, val); + return val; } /* @@ -781,7 +780,6 @@ id_at_con = rb_intern("@con"); id_empty_p = rb_intern("empty?"); id_clear = rb_intern("clear"); - id_set = rb_intern("set"); rb_define_private_method(cOCIStmt, "initialize", oci8_stmt_initialize, -1); rb_define_private_method(cOCIStmt, "__define", oci8_define_by_pos, 2); Modified: trunk/ruby-oci8/test/test_array_dml.rb =================================================================== --- trunk/ruby-oci8/test/test_array_dml.rb 2009-02-08 13:28:56 UTC (rev 319) +++ trunk/ruby-oci8/test/test_array_dml.rb 2009-02-10 13:50:40 UTC (rev 320) @@ -22,7 +22,8 @@ N NUMBER(10, 2), D DATE, INT NUMBER(30), - BIGNUM NUMBER(30)) + BIGNUM NUMBER(30), + T TIMESTAMP) STORAGE ( INITIAL 4k NEXT 4k @@ -31,23 +32,25 @@ PCTINCREASE 0) EOS @conn.exec(sql) - cursor = @conn.parse("INSERT INTO test_table VALUES (:C, :V, :N, :D, :INT, :BIGNUM)") + cursor = @conn.parse("INSERT INTO test_table VALUES (:C, :V, :N, :D, :INT, :BIGNUM, :T)") max_array_size = 3 cursor.max_array_size= max_array_size cursor.bind_param_array(1, nil, String) cursor.bind_param_array(2, nil ,String) cursor.bind_param_array(3, nil, Fixnum) - cursor.bind_param_array(4, nil, OraDate) + cursor.bind_param_array(4, nil, OraDate) cursor.bind_param_array(5, nil, Integer) cursor.bind_param_array(6, nil, Bignum) - + cursor.bind_param_array(7, nil, DateTime) + c_arr = Array.new v_arr = Array.new n_arr = Array.new d_arr = Array.new int_arr = Array.new bignum_arr = Array.new + t_arr = Array.new 1.upto(30) do |i| c_arr << format("%10d", i * 10) @@ -56,6 +59,7 @@ d_arr << OraDate.new(2000 + i, 12, 24, 23, 59, 59) int_arr << i * 11111111111 bignum_arr << i * 10000000000 + t_arr << DateTime.new(2000 + i, 12, 24, 23, 59, 59) if i%max_array_size == 0 cursor[1] = c_arr @@ -64,15 +68,24 @@ cursor[4] = d_arr cursor[5] = int_arr cursor[6] = bignum_arr + cursor[7] = t_arr r = cursor.exec_array assert_equal(max_array_size, r) + assert_equal(c_arr, cursor[1]) + assert_equal(v_arr, cursor[2]) + assert_equal(n_arr, cursor[3]) + assert_equal(d_arr, cursor[4]) + assert_equal(int_arr, cursor[5]) + assert_equal(bignum_arr, cursor[6]) + assert_equal(t_arr, cursor[7]) c_arr.clear v_arr.clear n_arr.clear d_arr.clear int_arr.clear bignum_arr.clear + t_arr.clear end end cursor.close @@ -81,7 +94,7 @@ cursor.define(5, Integer) cursor.define(6, Bignum) cursor.exec - assert_equal(["C","V","N","D","INT","BIGNUM"], cursor.get_col_names) + assert_equal(["C","V","N","D","INT","BIGNUM","T"], cursor.get_col_names) 1.upto(30) do |i| rv = cursor.fetch assert_equal(format("%10d", i * 10), rv[0]) @@ -91,6 +104,7 @@ assert_equal(tm, rv[3]) assert_equal(i * 11111111111, rv[4]) assert_equal(i * 10000000000, rv[5]) + assert_equal(tm, rv[6]) end assert_nil(cursor.fetch) drop_table('test_table') From nobody at rubyforge.org Sun Feb 15 09:58:37 2009 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 15 Feb 2009 09:58:37 -0500 (EST) Subject: [ruby-oci8-commit] [321] trunk/ruby-oci8: * ext/oci8/ocidatetime.c: fix array DML and DateTime object problem. Message-ID: <20090215145837.E1F3418580ED@rubyforge.org> Revision: 321 Author: kubo Date: 2009-02-15 09:58:37 -0500 (Sun, 15 Feb 2009) Log Message: ----------- * ext/oci8/ocidatetime.c: fix array DML and DateTime object problem. OCI8::Cursor#bind_param_array(key, array_of_datetime) didn't work. (Reported by Leo?\197?\161 Bitto) * test/test_array_dml.rb: fix to test array DML and DateTime object. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/ocidatetime.c trunk/ruby-oci8/test/test_array_dml.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2009-02-10 13:50:40 UTC (rev 320) +++ trunk/ruby-oci8/ChangeLog 2009-02-15 14:58:37 UTC (rev 321) @@ -1,3 +1,9 @@ +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 + work. (Reported by Leo? Bitto) + * test/test_array_dml.rb: fix to test array DML and DateTime object. + 2009-02-10 KUBO Takehiro * ext/oci8/bind.c, ext/oci8/oci8.h, ext/oci8/stmt.c: fix array DML and DateTime object problem. It didn't work with bind classes Modified: trunk/ruby-oci8/ext/oci8/ocidatetime.c =================================================================== --- trunk/ruby-oci8/ext/oci8/ocidatetime.c 2009-02-10 13:50:40 UTC (rev 320) +++ trunk/ruby-oci8/ext/oci8/ocidatetime.c 2009-02-15 14:58:37 UTC (rev 321) @@ -244,19 +244,19 @@ static void bind_ocitimestamp_set(oci8_bind_t *obind, void *data, void **null_structp, VALUE val) { - oci8_base_t *stmt; + oci8_base_t *parent; oci8_base_t *svcctx; - stmt = obind->base.parent; - if (stmt == NULL || stmt->type != OCI_HTYPE_STMT) { - rb_raise(rb_eRuntimeError, "oci8lib.so internal error [%s:%d, %p, %d]", - __FILE__, __LINE__, - stmt, stmt ? stmt->type : -1); + parent = obind->base.parent; + if (parent != NULL && parent->type == OCI_HTYPE_STMT) { + svcctx = parent->parent; + } else { + svcctx = parent; } - svcctx = stmt->parent; if (svcctx == NULL || svcctx->type != OCI_HTYPE_SVCCTX) { - rb_raise(rb_eRuntimeError, "oci8lib.so internal error [%s:%d, %p, %d]", + rb_raise(rb_eRuntimeError, "oci8lib.so internal error [%s:%d, %p, %d, %p, %d]", __FILE__, __LINE__, + parent, parent ? parent->type : -1, svcctx, svcctx ? svcctx->type : -1); } oci8_set_ocitimestamp(*(OCIDateTime **)data, val, svcctx->self); @@ -266,6 +266,7 @@ { oci8_bind_dsc_t *obind_dsc = (oci8_bind_dsc_t *)obind; + oci8_link_to_parent((oci8_base_t*)obind, (oci8_base_t*)oci8_get_svcctx(svc)); obind->value_sz = sizeof(OCIDateTime *); obind->alloc_sz = sizeof(OCIDateTime *); obind_dsc->type = OCI_DTYPE_TIMESTAMP_TZ; Modified: trunk/ruby-oci8/test/test_array_dml.rb =================================================================== --- trunk/ruby-oci8/test/test_array_dml.rb 2009-02-10 13:50:40 UTC (rev 320) +++ trunk/ruby-oci8/test/test_array_dml.rb 2009-02-15 14:58:37 UTC (rev 321) @@ -145,13 +145,15 @@ sql = <<-EOS CREATE TABLE test_table (N NUMBER(10, 2) NOT NULL, - V VARCHAR(20)) + V VARCHAR(20), + T TIMESTAMP) EOS @conn.exec(sql) - cursor = @conn.parse("INSERT INTO test_table VALUES (:N, :V)") + cursor = @conn.parse("INSERT INTO test_table VALUES (:N, :V, :T)") cursor.max_array_size = 3 cursor.bind_param_array(1, [1, 2, 3]) cursor.bind_param_array(2, ['happy', 'new', 'year']) + cursor.bind_param_array(3, [Time.gm(1990,1,1), Time.gm(2000,1,1), Time.gm(2010,1,1)]) assert_nothing_raised() { cursor.exec_array } cursor.max_array_size = 2 assert_raise(RuntimeError) { cursor.exec_array }