require 'ibm_db2'
require 'stringio'
require 'test/unit'

class TestIbmDb2 < Test::Unit::TestCase

  def test_231
    assert_equal expected, capture {
      conn = DB2::connect(db,user,password)
      
      result = DB2::exec(conn, "select * from sales")
      result2 = DB2::exec(conn, "select * from staff")
      result3 = DB2::exec(conn, "select * from emp_photo")
      
      for (i=0; i <= DB2::num_fields(result); i++)
       puts "#{i}:#{DB2::field_type(result,DB2::field_name(result,i))}\n"
      end
      puts "\n-----\n"
      for (i=0; i < DB2::num_fields(result2); i++)
       puts "#{i}:#{DB2::field_type(result2,DB2::field_name(result2,i))}\n"
      end
      puts "\n-----\n"
      for (i=0; i < DB2::num_fields(result3); i++)
       puts "#{i}:#{DB2::field_type(result3,DB2::field_name(result3,i))}\n"
      end
      puts "\n-----\n"
      
      puts "region:#{DB2::field_type(result,'region')}\n"
      puts "5:#{DB2::field_type(result2,5)}\n
    }
  end

end

__END__
0:string
1:string
2:string
3:int
4:

-----
0:int
1:string
2:int
3:string
4:int
5:real
6:real

-----
0:string
1:string
2:blob

-----
region:
5:real
