# Low-level API require 'oci8' require File.dirname(__FILE__) + '/config' class TestBindBoolean < Minitest::Test def setup @conn = get_oci8_connection() end def test_set_raw stmt = < 0 THEN bool_val := TRUE; ELSE bool_val := FALSE; END IF; :out := bool_val; END; EOS cursor = @conn.parse(stmt) cursor.bind_param(:in, nil, Integer) cursor.bind_param(:out, nil, TrueClass) cursor[:in] = 1 cursor.exec assert_equal(true, cursor[:out]) cursor[:in] = 0 cursor.exec assert_equal(false, cursor[:out]) do_block_cnt = 0 @conn.exec(stmt, 1, true) do |in_val, out_val| assert_equal(1, in_val) assert_equal(true, out_val) do_block_cnt += 1 end @conn.exec(stmt, 0, true) do |in_val, out_val| assert_equal(0, in_val) assert_equal(false, out_val) do_block_cnt += 1 end assert_equal(2, do_block_cnt) end def teardown @conn.logoff end end