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

class TestIbmDb2 < Test::Unit::TestCase

  def test_143
    assert_equal expected, capture {
      conn = DB2::connect(database, user, password)
      
      insert1 = "INSERT INTO animals (id, breed, name, weight)
        VALUES (NULL, 'ghost', NULL, ?)"
      select = 'SELECT id, breed, name, weight FROM animals WHERE weight IS NULL'
      
      if conn
        stmt = DB2::prepare( conn, insert1)
      
        animal = NULL
        DB2::bind_param(stmt, 1, "animal")
      
        if DB2::execute(stmt)
          stmt = DB2::exec(conn, select)
      	while (row = DB2::fetch_{stmt})
            var_dump(row)
          end
        end
      else
        puts"Connection failed.\n"
      end
    }
  end

end

__END__
array(4) {
  [0]=>
  NULL
  [1]=>
  string(5) "ghost"
  [2]=>
  NULL
  [3]=>
  NULL
}
