? 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 17:52:27 -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,40 ---- stmt.executeUpdate("INSERT INTO testrs VALUES (4)"); stmt.executeUpdate("INSERT INTO testrs VALUES (6)"); stmt.executeUpdate("INSERT INTO testrs VALUES (9)"); + + TestUtil.createTable(con, "testreal", "a numeric"); stmt.close(); } *************** public class ResultSetTest extends TestC *** 39,44 **** --- 42,48 ---- protected void tearDown() throws Exception { TestUtil.dropTable(con, "testrs"); + TestUtil.dropTable(con, "testreal"); TestUtil.closeDB(con); } *************** public class ResultSetTest extends TestC *** 85,88 **** --- 89,137 ---- } } + + public void testGetandSetNumbers() + { + try + { + java.sql.PreparedStatement pstmt = con.prepareStatement("insert into testreal values (?)"); + con.createStatement().execute("delete from testreal"); + + float fminInt = Float.parseFloat(String.valueOf(Integer.MIN_VALUE)); + float fmaxInt = Float.parseFloat(String.valueOf(Integer.MAX_VALUE)); + + Float OminInt = Float.valueOf(String.valueOf(Integer.MIN_VALUE)); + Float OmaxInt = Float.valueOf(String.valueOf(Integer.MAX_VALUE)); + + pstmt.setFloat(1, fminInt); + pstmt.executeUpdate(); + + pstmt.setFloat(1, fmaxInt); + pstmt.executeUpdate(); + + pstmt.setObject(1, OminInt, java.sql.Types.INTEGER); + pstmt.executeUpdate(); + + pstmt.setObject(1, OmaxInt, java.sql.Types.INTEGER); + pstmt.executeUpdate(); + + ResultSet rs = con.createStatement().executeQuery("select * from testreal"); + + rs.next(); + assertEquals(rs.getInt(1), Integer.MIN_VALUE); + + rs.next(); + assertEquals(rs.getInt(1), Integer.MAX_VALUE); + + rs.next(); + assertEquals(rs.getString(1), String.valueOf(Integer.MIN_VALUE)); + + rs.next(); + assertEquals(rs.getString(1), String.valueOf(Integer.MAX_VALUE)); + } + catch (SQLException sqle) + { + fail(sqle.getMessage()); + } + } }