class TestIbmDb2 < Test::Unit::TestCase

  def test_146
    assert_expect do
      conn = DB2::connect database, user, password
      
      if conn
        prepare_sp conn
        sql = 'CALL match_animal(?, ?, ?)'
        stmt = DB2::prepare conn, sql
      
        name = "Peaches"
        second_name = "Rickety Ride"
        weight = 0
        DB2::bind_param stmt, 1, "name", DB2::PARAM_IN
        DB2::bind_param stmt, 2, "second_name", DB2::PARAM_INOUT
        DB2::bind_param stmt, 3, "weight", DB2::PARAM_OUT
      
        puts "Values of bound parameters _before_ CALL:"
        print "  1: #{name} 2: #{second_name} 3: #{weight}\n\n"
      
        if DB2::execute(stmt)
            puts "Values of bound parameters _after_ CALL:"
            print "  1: #{name} 2: #{second_name} 3: #{weight}\n\n"
      
            puts "Results:"
            while (row = DB2::fetch_array(stmt))
                print "  #{row[0].strip}, #{row[1].strip}, #{row[2]}\n";    
            end
        end
      end
    end
  end

end

__END__
Values of bound parameters _before_ CALL:
  1: Peaches 2: Rickety Ride 3: 0

Values of bound parameters _after_ CALL:
  1: Peaches 2: TRUE 3: 12

Results:
  Peaches, dog, 12.30
  Pook, cat, 3.20
  Rickety Ride, goat, 9.70
  Smarty, horse, 350.00
  Sweater, llama, 150.00
