[ruby-oci8-commit] [467] trunk/ruby-oci8: fix a bug that an array is always bound as null.
nobody at rubyforge.org
nobody at rubyforge.org
Sat Nov 26 01:59:13 EST 2011
Revision: 467
Author: kubo
Date: 2011-11-26 01:59:12 -0500 (Sat, 26 Nov 2011)
Log Message:
-----------
fix a bug that an array is always bound as null. This bug was introduced in ruby-oci8 2.0.5.
(reported by Leo?\197?\161 Bitto)
Modified Paths:
--------------
trunk/ruby-oci8/ChangeLog
trunk/ruby-oci8/ext/oci8/object.c
trunk/ruby-oci8/test/test_object.rb
Modified: trunk/ruby-oci8/ChangeLog
===================================================================
--- trunk/ruby-oci8/ChangeLog 2011-11-23 13:15:14 UTC (rev 466)
+++ trunk/ruby-oci8/ChangeLog 2011-11-26 06:59:12 UTC (rev 467)
@@ -1,3 +1,8 @@
+2011-11-26 KUBO Takehiro <kubo at jiubao.org>
+ * ext/oci8/object.c, test/test_object.rb: fix a bug that an array is
+ always bound as null. This bug was introduced in ruby-oci8 2.0.5.
+ (reported by Leoš Bitto)
+
2011-11-23 KUBO Takehiro <kubo at jiubao.org>
* ext/oci8/oci8.c, lib/oci8/oci8.rb, lib/oci8/ocihandle.rb,
test/test_connstr.rb: support sysasm privilege.
Modified: trunk/ruby-oci8/ext/oci8/object.c
===================================================================
--- trunk/ruby-oci8/ext/oci8/object.c 2011-11-23 13:15:14 UTC (rev 466)
+++ trunk/ruby-oci8/ext/oci8/object.c 2011-11-26 06:59:12 UTC (rev 467)
@@ -389,6 +389,7 @@
set_coll_element_func(&cb_data);
set_coll_element_ensure(&cb_data);
#endif
+ *ind = 0;
return Qnil;
}
Modified: trunk/ruby-oci8/test/test_object.rb
===================================================================
--- trunk/ruby-oci8/test/test_object.rb 2011-11-23 13:15:14 UTC (rev 466)
+++ trunk/ruby-oci8/test/test_object.rb 2011-11-26 06:59:12 UTC (rev 467)
@@ -5,6 +5,9 @@
class RbTestObj < OCI8::Object::Base
end
+class RbTestIntArray < OCI8::Object::Base
+end
+
class TestObj1 < Test::Unit::TestCase
Delta = 0.00001
@@ -339,4 +342,35 @@
csr.exec
assert_equal('IS NULL', csr[:out])
end
+
+ def test_bind_array
+ csr = @conn.parse <<EOS
+DECLARE
+ ary RB_TEST_INT_ARRAY := :in;
+BEGIN
+ IF ary IS NULL THEN
+ :cnt := -1;
+ ELSE
+ :cnt := ary.count;
+ IF :cnt != 0 THEN
+ :out1 := ary(1);
+ :out2 := ary(2);
+ :out3 := ary(3);
+ END IF;
+ END IF;
+END;
+EOS
+ [nil, [], [1, nil, 3]].each do |ary|
+ csr.bind_param(:in, ary, RbTestIntArray)
+ csr.bind_param(:cnt, nil, Integer)
+ csr.bind_param(:out1, nil, Integer)
+ csr.bind_param(:out2, nil, Integer)
+ csr.bind_param(:out3, nil, Integer)
+ csr.exec
+ assert_equal(ary ? ary.length : -1, csr[:cnt])
+ assert_equal(ary ? ary[0] : nil, csr[:out1])
+ assert_equal(ary ? ary[1] : nil, csr[:out2])
+ assert_equal(ary ? ary[2] : nil, csr[:out3])
+ end
+ end
end
More information about the ruby-oci8-commit
mailing list