? crap Index: org/postgresql/test/jdbc2/ResultSetTest.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/test/jdbc2/ResultSetTest.java,v retrieving revision 1.7 diff -c -p -r1.7 ResultSetTest.java *** org/postgresql/test/jdbc2/ResultSetTest.java 29 May 2003 04:39:48 -0000 1.7 --- org/postgresql/test/jdbc2/ResultSetTest.java 4 Aug 2003 16:34:41 -0000 *************** import org.postgresql.test.TestUtil; *** 4,9 **** --- 4,10 ---- import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; + import java.sql.SQLException; import junit.framework.TestCase; *************** public class ResultSetTest extends TestC *** 32,37 **** --- 33,44 ---- stmt.executeUpdate("INSERT INTO testrs VALUES (4)"); stmt.executeUpdate("INSERT INTO testrs VALUES (6)"); stmt.executeUpdate("INSERT INTO testrs VALUES (9)"); + + TestUtil.createTable(con, "teststring", "a text"); + stmt.executeUpdate("INSERT INTO teststring VALUES ('12345')"); + + TestUtil.createTable(con, "testint", "a int"); + stmt.executeUpdate("INSERT INTO testint VALUES (12345)"); stmt.close(); } *************** public class ResultSetTest extends TestC *** 39,44 **** --- 46,53 ---- protected void tearDown() throws Exception { TestUtil.dropTable(con, "testrs"); + TestUtil.dropTable(con, "teststring"); + TestUtil.dropTable(con, "testint"); TestUtil.closeDB(con); } *************** public class ResultSetTest extends TestC *** 84,88 **** --- 93,131 ---- fail( ex.getMessage() ); } + } + + public void testMaxFieldSize() + { + try + { + Statement stmt = con.createStatement(); + stmt.setMaxFieldSize(2); + try + { + ResultSet rs = stmt.executeQuery("select * from testint"); + + rs.next(); + assertEquals(rs.getString(1),"12345"); + assertEquals(new String(rs.getBytes(1)), "12345"); + + rs = stmt.executeQuery("select * from teststring"); + rs.next(); + assertEquals(rs.getString(1), "12"); + assertEquals(new String(rs.getBytes(1)), "12"); + } + catch (Exception e) + { + fail(e.getMessage()); + } + finally + { + stmt.setMaxFieldSize(0); + } + } + catch (SQLException sqle) + { + fail(sqle.getMessage()); + } } }