class TestIbmDb2 < Test::Unit::TestCase

  def test_133
    assert_expectf {
      assert_throws :'Statement Execute Failed' do
        sql =  "INSERT INTO animals (id, breed, name, weight)
          VALUES (?, ?, ?, ?)"
        conn = DB2::connect database, user, password
        if !conn
          throw "Connection failed.\n"
        end
        
        stmt = DB2::prepare conn, sql
        res = DB2::execute stmt, [128, 'hacker of human and technological nature', 'Wez the ruler of all things PECL', 88.3]
        var_dump(res)
        print "SQLSTATE: #{DB2::stmt_error(stmt)}"
        print "\nMessage: #{DB2::stmt_errormsg(stmt)}"
        stmt = DB2::prepare conn, "SELECT breed, name FROM animals WHERE id = ?"
        res = DB2::execute stmt, [128]
        row = DB2::fetch_assoc stmt
        print_r(row)
      end
    }
  end

end

__END__

