From nobody at rubyforge.org Tue Dec 4 08:40:03 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Tue, 4 Dec 2007 08:40:03 -0500 (EST) Subject: [Ruby-oci8-commit] [230] trunk/ruby-oci8: * ext/oci8/stmt.c, lib/oci8/oci8.rb: delete a private method Message-ID: <20071204134004.097D0159806C@rubyforge.org> Revision: 230 Author: kubo Date: 2007-12-04 08:40:03 -0500 (Tue, 04 Dec 2007) Log Message: ----------- * ext/oci8/stmt.c, lib/oci8/oci8.rb: delete a private method OCI8::Curosr#__connection and use @con instead. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/ext/oci8/stmt.c trunk/ruby-oci8/lib/oci8/oci8.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2007-12-04 12:57:51 UTC (rev 229) +++ trunk/ruby-oci8/ChangeLog 2007-12-04 13:40:03 UTC (rev 230) @@ -1,4 +1,8 @@ 2007-12-04 KUBO Takehiro + * ext/oci8/stmt.c, lib/oci8/oci8.rb: delete a private method + OCI8::Curosr#__connection and use @con instead. + +2007-12-04 KUBO Takehiro * ext/oci8/extconf.rb: compile xmldb.o by default. * ext/oci8/lob.c, ext/oci8/metadata.c, ext/oci8/oci8.c: use functions which ends with _nb instead of normal OCI functions Modified: trunk/ruby-oci8/ext/oci8/stmt.c =================================================================== --- trunk/ruby-oci8/ext/oci8/stmt.c 2007-12-04 12:57:51 UTC (rev 229) +++ trunk/ruby-oci8/ext/oci8/stmt.c 2007-12-04 13:40:03 UTC (rev 230) @@ -518,12 +518,6 @@ return oci8_get_ub4_attr(DATA_PTR(self), OCI_ATTR_PARAM_COUNT); } -static VALUE oci8_stmt_connection(VALUE self) -{ - oci8_stmt_t *stmt = DATA_PTR(self); - return stmt->svc; -} - /* * Gets the value of the bind variable. * @@ -718,7 +712,6 @@ rb_define_method(cOCIStmt, "row_count", oci8_stmt_get_row_count, 0); rb_define_method(cOCIStmt, "rowid", oci8_stmt_get_rowid, 0); rb_define_private_method(cOCIStmt, "__param_count", oci8_stmt_get_param_count, 0); - rb_define_private_method(cOCIStmt, "__connection", oci8_stmt_connection, 0); rb_define_method(cOCIStmt, "[]", oci8_stmt_aref, 1); rb_define_method(cOCIStmt, "[]=", oci8_stmt_aset, 2); rb_define_method(cOCIStmt, "keys", oci8_stmt_keys, 0); Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2007-12-04 12:57:51 UTC (rev 229) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2007-12-04 13:40:03 UTC (rev 230) @@ -423,7 +423,7 @@ bindclass = OCI8::BindType::Mapping[key] raise "unsupported datatype: #{key}" if bindclass.nil? - bindclass.create(__connection, val, param, max_array_size) + bindclass.create(@con, val, param, max_array_size) end def define_columns From nobody at rubyforge.org Sun Dec 23 10:29:22 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sun, 23 Dec 2007 10:29:22 -0500 (EST) Subject: [ruby-oci8-commit] [231] trunk/ruby-oci8/ext/oci8: * ext/oci8/oraconf.rb: fix for official x86_64 rpms. Message-ID: <20071223152922.798F118585E4@rubyforge.org> Revision: 231 Author: kubo Date: 2007-12-23 10:29:22 -0500 (Sun, 23 Dec 2007) Log Message: ----------- * ext/oci8/oraconf.rb: fix for official x86_64 rpms. (contributed by Pat.) 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 2007-12-04 13:40:03 UTC (rev 230) +++ branches/ruby-oci8-1.0/ChangeLog 2007-12-23 15:29:22 UTC (rev 231) @@ -1,3 +1,7 @@ +2007-12-23 KUBO Takehiro + * ext/oci8/oraconf.rb: fix for official x86_64 rpms. + (contributed by Pat.) + 2007-11-25 KUBO Takehiro release as 1.0.0 again. * ext/oci8/stmt.c, test/test_dbi.rb: fix a problem when binding Modified: branches/ruby-oci8-1.0/ext/oci8/oraconf.rb =================================================================== --- branches/ruby-oci8-1.0/ext/oci8/oraconf.rb 2007-12-04 13:40:03 UTC (rev 230) +++ branches/ruby-oci8-1.0/ext/oci8/oraconf.rb 2007-12-23 15:29:22 UTC (rev 231) @@ -833,10 +833,23 @@ def initialize(ic_dir) init - if ic_dir =~ /^\/usr\/lib(?:64)?\/oracle\/(\d+\.\d+\.\d+\.\d+)\/client\/lib(?:64)?/ + if ic_dir =~ /^\/usr\/lib(?:64)?\/oracle\/(\d+\.\d+\.\d+\.\d+)\/client(64)?\/lib(?:64)?/ # rpm package + # official x86 rpms: + # library: /usr/lib/oracle/X.X.X.X.X/client/lib/ + # include: /usr/include/oracle/X.X.X.X.X/client/ + # + # official x86_64 rpms: + # library: /usr/lib/oracle/X.X.X.X.X/client64/lib/ + # include: /usr/include/oracle/X.X.X.X.X/client64/ + # + # third-party x86_64 rpms: + # library: /usr/lib64/oracle/X.X.X.X.X/client/lib/ + # or /usr/lib64/oracle/X.X.X.X.X/client/lib64/ + # include: /usr/include/oracle/X.X.X.X.X/client/ + # lib_dir = ic_dir - inc_dir = "/usr/include/oracle/#{$1}/client" + inc_dir = "/usr/include/oracle/#{$1}/client#{$2}" else # zip package lib_dir = ic_dir Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2007-12-04 13:40:03 UTC (rev 230) +++ trunk/ruby-oci8/ChangeLog 2007-12-23 15:29:22 UTC (rev 231) @@ -1,3 +1,7 @@ +2007-12-23 KUBO Takehiro + * ext/oci8/oraconf.rb: fix for official x86_64 rpms. + (contributed by Pat.) + 2007-12-04 KUBO Takehiro * ext/oci8/stmt.c, lib/oci8/oci8.rb: delete a private method OCI8::Curosr#__connection and use @con instead. Modified: trunk/ruby-oci8/ext/oci8/oraconf.rb =================================================================== --- trunk/ruby-oci8/ext/oci8/oraconf.rb 2007-12-04 13:40:03 UTC (rev 230) +++ trunk/ruby-oci8/ext/oci8/oraconf.rb 2007-12-23 15:29:22 UTC (rev 231) @@ -834,10 +834,23 @@ def initialize(ic_dir) init - if ic_dir =~ /^\/usr\/lib(?:64)?\/oracle\/(\d+\.\d+\.\d+\.\d+)\/client\/lib(?:64)?/ + if ic_dir =~ /^\/usr\/lib(?:64)?\/oracle\/(\d+\.\d+\.\d+\.\d+)\/client(64)?\/lib(?:64)?/ # rpm package + # official x86 rpms: + # library: /usr/lib/oracle/X.X.X.X.X/client/lib/ + # include: /usr/include/oracle/X.X.X.X.X/client/ + # + # official x86_64 rpms: + # library: /usr/lib/oracle/X.X.X.X.X/client64/lib/ + # include: /usr/include/oracle/X.X.X.X.X/client64/ + # + # third-party x86_64 rpms: + # library: /usr/lib64/oracle/X.X.X.X.X/client/lib/ + # or /usr/lib64/oracle/X.X.X.X.X/client/lib64/ + # include: /usr/include/oracle/X.X.X.X.X/client/ + # lib_dir = ic_dir - inc_dir = "/usr/include/oracle/#{$1}/client" + inc_dir = "/usr/include/oracle/#{$1}/client#{$2}" else # zip package lib_dir = ic_dir From nobody at rubyforge.org Sat Dec 29 08:32:19 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sat, 29 Dec 2007 08:32:19 -0500 (EST) Subject: [ruby-oci8-commit] [232] branches/ruby-oci8-1.0: * lib/oci8.rb.in: support cursors in a result set. Message-ID: <20071229133219.3A36818586BA@rubyforge.org> Revision: 232 Author: kubo Date: 2007-12-29 08:32:18 -0500 (Sat, 29 Dec 2007) Log Message: ----------- * lib/oci8.rb.in: support cursors in a result set. For example: SELECT column1 A, column2 B, CURSOR(SELECT * FROM table2) C FROM table1 (contributed by Randy Gordon) * test/test_oci8.rb: add a testcase for cursors in a result set. Modified Paths: -------------- branches/ruby-oci8-1.0/ChangeLog branches/ruby-oci8-1.0/lib/oci8.rb.in branches/ruby-oci8-1.0/test/test_oci8.rb Modified: branches/ruby-oci8-1.0/ChangeLog =================================================================== --- branches/ruby-oci8-1.0/ChangeLog 2007-12-23 15:29:22 UTC (rev 231) +++ branches/ruby-oci8-1.0/ChangeLog 2007-12-29 13:32:18 UTC (rev 232) @@ -1,3 +1,10 @@ +2007-12-29 KUBO Takehiro + * lib/oci8.rb.in: support cursors in a result set. For example: + SELECT column1 A, column2 B, CURSOR(SELECT * FROM table2) C + FROM table1 + (contributed by Randy Gordon) + * test/test_oci8.rb: add a testcase for cursors in a result set. + 2007-12-23 KUBO Takehiro * ext/oci8/oraconf.rb: fix for official x86_64 rpms. (contributed by Pat.) Modified: branches/ruby-oci8-1.0/lib/oci8.rb.in =================================================================== --- branches/ruby-oci8-1.0/lib/oci8.rb.in 2007-12-23 15:29:22 UTC (rev 231) +++ branches/ruby-oci8-1.0/lib/oci8.rb.in 2007-12-29 13:32:18 UTC (rev 232) @@ -29,9 +29,10 @@ class OCIDefine # :nodoc: # define handle of OCILobLocator needs @env and @svc. - def set_handle(env, svc) + def set_handle(env, svc, ctx) @env = env @svc = svc + @ctx = ctx end end @@ -855,11 +856,10 @@ else b = @stmt.bindByName(key, type, option) end - b.set_handle(@env, @svc, @ctx) when :define b = @stmt.defineByPos(key, type, option) - b.set_handle(@env, @svc) end + b.set_handle(@env, @svc, @ctx) if binder && binder.respond_to?(:decorate) # decorate the bind handle. @@ -1259,6 +1259,9 @@ BindType::Mapping[OCI8::SQLT_IBFLOAT] = BindType::Float BindType::Mapping[OCI8::SQLT_IBDOUBLE] = BindType::Float end + + # cursor in result set. + BindType::Mapping[SQLT_RSET] = BindType::Cursor end # OCI8 class OraDate Modified: branches/ruby-oci8-1.0/test/test_oci8.rb =================================================================== --- branches/ruby-oci8-1.0/test/test_oci8.rb 2007-12-23 15:29:22 UTC (rev 231) +++ branches/ruby-oci8-1.0/test/test_oci8.rb 2007-12-29 13:32:18 UTC (rev 232) @@ -158,6 +158,46 @@ drop_table('test_table') end + def test_cursor_in_result_set + drop_table('test_table') + sql = <<-EOS +CREATE TABLE test_table (N NUMBER(10, 2)) +STORAGE ( + INITIAL 4k + NEXT 4k + MINEXTENTS 1 + MAXEXTENTS UNLIMITED + PCTINCREASE 0) +EOS + @conn.exec(sql) + cursor = @conn.parse("INSERT INTO test_table VALUES (:1)") + 1.upto(10) do |i| + cursor.exec(i) + end + cursor.close + cursor = @conn.exec(<= 1000 # Oracle 10g or upper def test_binary_float From nobody at rubyforge.org Sat Dec 29 08:38:23 2007 From: nobody at rubyforge.org (nobody at rubyforge.org) Date: Sat, 29 Dec 2007 08:38:23 -0500 (EST) Subject: [ruby-oci8-commit] [233] trunk/ruby-oci8: * lib/oci8/metadata.rb, lib/oci8/oci8.rb: support cursors in a Message-ID: <20071229133823.8B97D18586B1@rubyforge.org> Revision: 233 Author: kubo Date: 2007-12-29 08:38:23 -0500 (Sat, 29 Dec 2007) Log Message: ----------- * lib/oci8/metadata.rb, lib/oci8/oci8.rb: support cursors in a result set. For example: SELECT column1 A, column2 B, CURSOR(SELECT * FROM table2) C FROM table1 (port from changes in 1.0.0, which is contributed by Randy Gordon) * test/test_oci8.rb: add a testcase for cursors in a result set. Modified Paths: -------------- trunk/ruby-oci8/ChangeLog trunk/ruby-oci8/lib/oci8/metadata.rb trunk/ruby-oci8/lib/oci8/oci8.rb trunk/ruby-oci8/test/test_oci8.rb Modified: trunk/ruby-oci8/ChangeLog =================================================================== --- trunk/ruby-oci8/ChangeLog 2007-12-29 13:32:18 UTC (rev 232) +++ trunk/ruby-oci8/ChangeLog 2007-12-29 13:38:23 UTC (rev 233) @@ -1,3 +1,11 @@ +2007-12-29 KUBO Takehiro + * lib/oci8/metadata.rb, lib/oci8/oci8.rb: support cursors in a + result set. For example: + SELECT column1 A, column2 B, CURSOR(SELECT * FROM table2) C + FROM table1 + (port from changes in 1.0.0, which is contributed by Randy Gordon) + * test/test_oci8.rb: add a testcase for cursors in a result set. + 2007-12-23 KUBO Takehiro * ext/oci8/oraconf.rb: fix for official x86_64 rpms. (contributed by Pat.) Modified: trunk/ruby-oci8/lib/oci8/metadata.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/metadata.rb 2007-12-29 13:32:18 UTC (rev 232) +++ trunk/ruby-oci8/lib/oci8/metadata.rb 2007-12-29 13:38:23 UTC (rev 233) @@ -364,6 +364,8 @@ DATA_TYPE_MAP[113] = [:blob, "BLOB"] # SQLT_BFILE DATA_TYPE_MAP[114] = [:bfile, "BFILE"] + # SQLT_RSET + DATA_TYPE_MAP[116] = [:cursor, "CURSOR"] # SQLT_TIMESTAMP DATA_TYPE_MAP[187] = [:timestamp, Proc.new do |p| Modified: trunk/ruby-oci8/lib/oci8/oci8.rb =================================================================== --- trunk/ruby-oci8/lib/oci8/oci8.rb 2007-12-29 13:32:18 UTC (rev 232) +++ trunk/ruby-oci8/lib/oci8/oci8.rb 2007-12-29 13:38:23 UTC (rev 233) @@ -620,5 +620,8 @@ OCI8::BindType::Mapping[:binary_double] = OCI8::BindType::Float end +# Cursor +OCI8::BindType::Mapping[:cursor] = OCI8::BindType::Cursor + # XMLType (This mapping will be changed before release.) OCI8::BindType::Mapping[:xmltype] = OCI8::BindType::Long Modified: trunk/ruby-oci8/test/test_oci8.rb =================================================================== --- trunk/ruby-oci8/test/test_oci8.rb 2007-12-29 13:32:18 UTC (rev 232) +++ trunk/ruby-oci8/test/test_oci8.rb 2007-12-29 13:38:23 UTC (rev 233) @@ -186,6 +186,46 @@ drop_table('test_table') end + def test_cursor_in_result_set + drop_table('test_table') + sql = <<-EOS +CREATE TABLE test_table (N NUMBER(10, 2)) +STORAGE ( + INITIAL 4k + NEXT 4k + MINEXTENTS 1 + MAXEXTENTS UNLIMITED + PCTINCREASE 0) +EOS + @conn.exec(sql) + cursor = @conn.parse("INSERT INTO test_table VALUES (:1)") + 1.upto(10) do |i| + cursor.exec(i) + end + cursor.close + cursor = @conn.exec(<= 1000 # Oracle 10g or upper def test_binary_float