public Byte toByte(Double self) { return self.byteValue(); } }
return (X) Byte.valueOf( value.byteValue() );
/** * @param value string represented numerical value * @return value as Byte */ public static Byte getByteValue(String value) { nBytes++; return parseDoubleUnit(value).byteValue(); }
private void updateSignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateUnsignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + testUnsignedTable + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateUnsignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement( "UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateSignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setBigDecimal(2, BigDecimal.valueOf(data)); stmt.setDouble(3, d.doubleValue()); stmt.setFloat(4, d.floatValue()); stmt.setInt(5, d.intValue()); stmt.setLong(6, d.longValue()); stmt.setShort(7, d.shortValue()); stmt.setByte(8, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateTableSpec(Connection conn, double data, String tableName) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateSignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + testSignedTable + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateUnsignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateSignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement( "UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateUnsignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement( "UPSERT INTO " + unsignedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateSignedTable(Connection conn, double data) throws Exception { PreparedStatement stmt = conn.prepareStatement( "UPSERT INTO " + signedTableName + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setBigDecimal(2, BigDecimal.valueOf(data)); stmt.setDouble(3, d.doubleValue()); stmt.setFloat(4, d.floatValue()); stmt.setInt(5, d.intValue()); stmt.setLong(6, d.longValue()); stmt.setShort(7, d.shortValue()); stmt.setByte(8, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void updateTableSpec(Connection conn, double data, String tableName) throws Exception { PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + tableName + " VALUES (?, ?, ?, ?, ?, ?, ?)"); stmt.setString(1, KEY); Double d = Double.valueOf(data); stmt.setDouble(2, d.doubleValue()); stmt.setFloat(3, d.floatValue()); stmt.setInt(4, d.intValue()); stmt.setLong(5, d.longValue()); stmt.setShort(6, d.shortValue()); stmt.setByte(7, d.byteValue()); stmt.executeUpdate(); conn.commit(); }
private void testSignedNumberSpec(Connection conn, double data) throws Exception { updateSignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery("SELECT EXP(doub),EXP(fl),EXP(inte),EXP(lon),EXP(smalli),EXP(tinyi) FROM " + signedTableName); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.exp(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.exp(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.exp(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.exp(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.exp(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.exp(d.byteValue())) < ZERO); assertTrue(!rs.next()); }
private void testUnsignedNumberSpec(Connection conn, double data) throws Exception { updateUnsignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery("SELECT EXP(doub),EXP(fl),EXP(inte),EXP(lon),EXP(smalli),EXP(tinyi) FROM " + unsignedTableName); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.exp(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.exp(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.exp(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.exp(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.exp(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.exp(d.byteValue())) < ZERO); assertTrue(!rs.next()); }
private void testUnsignedNumberSpec(Connection conn, double data) throws Exception { updateUnsignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery("SELECT SQRT(doub),SQRT(fl),SQRT(inte),SQRT(lon),SQRT(smalli),SQRT(tinyi) FROM " + testUnsignedTable ); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.sqrt(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.sqrt(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.sqrt(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.sqrt(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.sqrt(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.sqrt(d.byteValue())) < ZERO); assertTrue(!rs.next()); PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + testUnsignedTable + " WHERE SQRT(doub)>0 AND SQRT(fl)>0 AND SQRT(inte)>0 AND SQRT(lon)>0 AND SQRT(smalli)>0 AND SQRT(tinyi)>0"); rs = stmt.executeQuery(); if (data > 0) { assertTrue(rs.next()); assertEquals(KEY, rs.getString(1)); } assertTrue(!rs.next()); }
private void testSignedNumberSpec(Connection conn, double data) throws Exception { updateSignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery("SELECT SQRT(doub),SQRT(fl),SQRT(inte),SQRT(lon),SQRT(smalli),SQRT(tinyi) FROM " + testSignedTable ); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.sqrt(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.sqrt(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.sqrt(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.sqrt(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.sqrt(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.sqrt(d.byteValue())) < ZERO); assertTrue(!rs.next()); PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + testSignedTable + " WHERE SQRT(doub)>0 AND SQRT(fl)>0 AND SQRT(inte)>0 AND SQRT(lon)>0 AND SQRT(smalli)>0 AND SQRT(tinyi)>0"); rs = stmt.executeQuery(); if (data > 0) { assertTrue(rs.next()); assertEquals(KEY, rs.getString(1)); } assertTrue(!rs.next()); }
private void testSignedNumberSpec(Connection conn, double data) throws Exception { updateSignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery( "SELECT CBRT(doub),CBRT(fl),CBRT(inte),CBRT(lon),CBRT(smalli),CBRT(tinyi) FROM " + signedTableName); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.cbrt(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.cbrt(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.cbrt(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.cbrt(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.cbrt(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.cbrt(d.byteValue())) < ZERO); assertTrue(!rs.next()); PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + signedTableName + " WHERE CBRT(doub)>0 AND CBRT(fl)>0 AND CBRT(inte)>0 AND CBRT(lon)>0 AND CBRT(smalli)>0 AND CBRT(tinyi)>0"); rs = stmt.executeQuery(); if (data > 0) { assertTrue(rs.next()); assertEquals(KEY, rs.getString(1)); } assertTrue(!rs.next()); }
private void testUnsignedNumberSpec(Connection conn, double data) throws Exception { updateUnsignedTable(conn, data); ResultSet rs = conn.createStatement().executeQuery( "SELECT CBRT(doub),CBRT(fl),CBRT(inte),CBRT(lon),CBRT(smalli),CBRT(tinyi) FROM " + unsignedTableName); assertTrue(rs.next()); Double d = Double.valueOf(data); assertTrue(Math.abs(rs.getDouble(1) - Math.cbrt(d.doubleValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(2) - Math.cbrt(d.floatValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(3) - Math.cbrt(d.intValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(4) - Math.cbrt(d.longValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(5) - Math.cbrt(d.shortValue())) < ZERO); assertTrue(Math.abs(rs.getDouble(6) - Math.cbrt(d.byteValue())) < ZERO); assertTrue(!rs.next()); PreparedStatement stmt = conn.prepareStatement("SELECT k FROM " + unsignedTableName + " WHERE CBRT(doub)>0 AND CBRT(fl)>0 AND CBRT(inte)>0 AND CBRT(lon)>0 AND CBRT(smalli)>0 AND CBRT(tinyi)>0"); rs = stmt.executeQuery(); if (data > 0) { assertTrue(rs.next()); assertEquals(KEY, rs.getString(1)); } assertTrue(!rs.next()); }