spec/adapters/oracle_spec.rb in sequel-5.11.0 vs spec/adapters/oracle_spec.rb in sequel-5.12.0

- old
+ new

@@ -323,5 +323,49 @@ it "should work correctly with temporary clobs" do DB[:xml_test].insert("<a href='b'>c</a>") DB.from(Sequel.lit('xml_test x')).select(Sequel.lit("x.xml_col.getCLOBVal() v")).all.must_equal [{:v=>"<a href=\"b\">c</a>\n"}] end end + +describe "Clob Bound Argument Type" do + before(:all) do + @db = DB + @db.create_table!(:items) do + primary_key :id + clob :c + end + @ds = @db[:items] + end + before do + @ds.delete + end + after(:all) do + @db.drop_table?(:items) + end + + it "should handle clob type in prepared statement arguments" do + @ds.delete + clob = "\"'[]`a0 " + @ds.prepare(:insert, :ps_clob, {:c=>@db.adapter_scheme == :oracle ? :$c__clob : :$c}).call(:c=>clob) + @ds.get(:c).must_equal clob + end +end + +describe "CLOB Returning Procedure" do + before do + DB.run <<SQL +CREATE OR REPLACE PROCEDURE testCLOB(outParam OUT CLOB) +IS +BEGIN + outParam := 'Hello World CLOB OUT parameter'; +END; +SQL + end + after do + DB.run("DROP PROCEDURE testCLOB") + end + + it "should work correctly with output clobs" do + res = DB.execute("begin testCLOB(:1); end;", {:arguments => [[nil, 'clob']]}) {|c| c[1].read } + res.must_equal 'Hello World CLOB OUT parameter' + end +end if DB.adapter_scheme == :oracle