
import java.sql.ResultSet;
import java.sql.SQLException;

public class BadResultSetAccessTest
{
	public void test0( ResultSet rs ) throws SQLException {
		for (int i = 0; i < 5; i++) {
			System.out.println(rs.getString(i));
		}	
	}

	public void test1( ResultSet rs ) throws SQLException {
		int i = rs.getInt(0);
		i++;
		rs.updateInt(0, i );
	}
	
	public void test2( ResultSet rs ) throws SQLException {
		String s = rs.getString(0);
		s = s.substring(1);
		rs.updateString(0, s );
	}
	
	public void test3( ResultSet rs ) throws SQLException {
		String s = rs.getString("foo");
		s = s.substring(1);
		rs.updateString("foo", s );
	}
	
	public void test4( ResultSet rs ) throws SQLException {
		rs.updateBinaryStream( 1, null, 0 );
	}
}
@@ -1,24 +1,59 @@
+%0Aimport java.sql.ResultSetMetaData;
 %0Aimport java.sql.ResultS
@@ -56,16 +56,16 @@
 ultSet;%0A
-
 import j
@@ -182,16 +182,103 @@
 ption %7B%0A
+%09%09ResultSetMetaData rsmd = rs.getMetaData();%0A%09%09int numCols = rsmd.getColumnCount();%0A%09%09%0A
 %09%09for (i
@@ -295,9 +295,15 @@
 i %3C 
-5
+numCols
 ; i+
@@ -330,26 +330,87 @@
 rint
-ln(rs.getString(i)
+( %22i = %5B%22 + i + %22%5D  %22 );%0A%09%09%09String s = rs.getString(i);%0A%09%09%09System.out.println(s
 );%0A%09

make the test harder