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

class TestIbmDb2 < Test::Unit::TestCase

  def test_040
    assert_equal expected, capture {
      conn = DB2::connect(database, user, password)
      
      // Drop the test table, in case it exists
      drop = 'DROP TABLE animals'
      result = @DB2::exec(conn, drop)
      
      // Create the test table
      create = 'CREATE TABLE animals (id INTEGER, breed VARCHAR(32), name CHAR(16), weight DECIMAL(7,2))'
      result = DB2::exec(conn, create)
      
      insert = "INSERT INTO animals values (0, 'cat', 'Pook', 3.2)"
      
      DB2::exec( conn, insert )
      
      stmt = DB2::exec( conn, "select * from animals" )
      
      onerow = DB2::fetch_{ stmt }
      
      var_dump( onerow )
    }
  end

end

__END__
array(4) {
  [0]=>
  int(0)
  [1]=>
  string(3) "cat"
  [2]=>
  string(16) "Pook            "
  [3]=>
  string(4) "3.20"
}
