Hello, I found the same bugs yesterday while running SUN's JDBC testsuite. It will be fixed in the next version of the JDBC-driver.
Regards and thank you for reporting these bugs, Marco. ---------------------------------------------- Marco PASKAMP SAP DB, SAP Labs Berlin > -----Original Message----- > From: Blas Rodriguez Somoza [mailto:[EMAIL PROTECTED]] > Sent: Montag, 15. April 2002 20:09 > To: [EMAIL PROTECTED] > Subject: JDBC bugs in get/set > > > Hello > > I find two errors in get/set methods, there are two erroneous > translations in numeric values. The code is the following > > java.sql.Statement stmt = conn.createStatement(); > String Tab2_Create = "create table tab_fixed( max_val fixed(38,2)" > +" , min_val fixed(38,2) , null_val fixed(38,2) )"; > stmt.executeUpdate(Tab2_Create); > > stmt.executeUpdate("insert into tab_fixed values(null,null,null)"); > > java.sql.PreparedStatement ps = > conn.prepareStatement("update tab_fixed > set max_val = ?"); > java.math.BigDecimal value = new > java.math.BigDecimal("9223372036854775808"); > ps.setBigDecimal(1,value); > ps.executeUpdate(); > java.sql.ResultSet rs = stmt.executeQuery("select max_val from > tab_fixed"); > rs.next(); > long lt = rs.getLong(1); > String sLt = rs.getString(1); > rs.close(); > stmt.executeUpdate("drop table tab_fixed"); > > System.out.println("setBigDecimal ="+value+" getLong="+lt+" > getString="+sLt); > > Tab2_Create = "create table tab_float( max_val float" > +" , min_val float, null_val float)"; > stmt.executeUpdate(Tab2_Create); > > stmt.executeUpdate("insert into tab_float values(null,null,null)"); > > // getInt > ps = conn.prepareStatement("update tab_float set max_val = ?"); > Float fValue = new Float("2147483647"); > ps.setFloat(1,fValue.floatValue()); > ps.executeUpdate(); > rs = stmt.executeQuery("select max_val from tab_float"); > rs.next(); > int it = rs.getInt(1); > String sIt = rs.getString(1); > rs.close(); > > stmt.executeUpdate("drop table tab_float"); > System.out.println("setFloat ="+fValue+" getInt="+it+" > getString="+sIt); > > stmt.close(); > > The printout is : > > setBigDecimal = 9223372036854775808 getLong= > -9223372036854775808 getString= > 9223372036854775808 > setFloat = 2.14748365E9 getInt= -2147483648 getString= 2147483648 > > There are a minus sign in the getLong and getInt that must > not be here. > > Regards > Blas Rodriguez Somoza > > _______________________________________________ > sapdb.general mailing list > [EMAIL PROTECTED] > http://listserv.sap.com/mailman/listinfo/sapdb.general > _______________________________________________ sapdb.general mailing list [EMAIL PROTECTED] http://listserv.sap.com/mailman/listinfo/sapdb.general
