? temp.diff Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v retrieving revision 1.29 diff -c -p -r1.29 AbstractJdbc1Statement.java *** org/postgresql/jdbc1/AbstractJdbc1Statement.java 24 Jul 2003 00:30:39 -0000 1.29 --- org/postgresql/jdbc1/AbstractJdbc1Statement.java 24 Jul 2003 19:44:09 -0000 *************** public abstract class AbstractJdbc1State *** 1491,1504 **** switch (targetSqlType) { case Types.INTEGER: if (x instanceof Boolean) bind(parameterIndex,((Boolean)x).booleanValue() ? "1" :"0", PG_BOOLEAN); else ! bind(parameterIndex, escapeString(x.toString()), PG_INTEGER); break; - case Types.TINYINT: - case Types.SMALLINT: - case Types.BIGINT: case Types.REAL: case Types.FLOAT: case Types.DOUBLE: --- 1491,1504 ---- switch (targetSqlType) { case Types.INTEGER: + case Types.TINYINT: + case Types.SMALLINT: + case Types.BIGINT: if (x instanceof Boolean) bind(parameterIndex,((Boolean)x).booleanValue() ? "1" :"0", PG_BOOLEAN); else ! bindIntegers(parameterIndex, x, targetSqlType); break; case Types.REAL: case Types.FLOAT: case Types.DOUBLE: *************** public abstract class AbstractJdbc1State *** 2185,2191 **** tmpts.setNanos(nanosVal); return tmpts; } ! private static final String PG_TEXT = "text"; private static final String PG_INTEGER = "integer"; --- 2185,2217 ---- tmpts.setNanos(nanosVal); return tmpts; } ! ! private void bindIntegers(int parameterIndex, Object x, int target) throws SQLException ! { ! String result; ! String type; ! try { ! switch (target) ! { ! case Types.INTEGER: ! case Types.SMALLINT: ! case Types.TINYINT: ! result = String.valueOf(Float.valueOf(x.toString()).intValue()); ! type = PG_INTEGER; ! break; ! default: ! result = String.valueOf(Double.valueOf(x.toString()).longValue()); ! type = PG_INT8; ! break; ! } ! bind(parameterIndex, escapeString(result), type); ! } ! catch (NumberFormatException e) ! { ! //leave in for backward compatibility. ! bind(parameterIndex, escapeString(x.toString()), PG_INTEGER); ! } ! } private static final String PG_TEXT = "text"; private static final String PG_INTEGER = "integer";