private PGType createInternalType( Object x, int targetType ) throws PSQLException { if ( x instanceof Byte ) return PGByte.castToServerType((Byte)x, targetType ); if ( x instanceof Short ) return PGShort.castToServerType((Short)x, targetType ); if ( x instanceof Integer ) return PGInteger.castToServerType((Integer)x, targetType ); if ( x instanceof Long ) return PGLong.castToServerType((Long)x, targetType ); if ( x instanceof Double ) return PGDouble.castToServerType((Double)x, targetType ); if ( x instanceof Float ) return PGFloat.castToServerType((Float)x, targetType ); if ( x instanceof BigDecimal) return PGBigDecimal.castToServerType((BigDecimal)x, targetType ); // since all of the above are instances of Number make sure this is after them if ( x instanceof Number ) return PGNumber.castToServerType((Number)x, targetType ); if ( x instanceof Boolean) return PGBoolean.castToServerType((Boolean)x, targetType ); return new PGUnknown(x); } // Helper method for setting parameters to PGobject subclasses.
private PGType createInternalType( Object x, int targetType ) throws PSQLException { if ( x instanceof Byte ) return PGByte.castToServerType((Byte)x, targetType ); if ( x instanceof Short ) return PGShort.castToServerType((Short)x, targetType ); if ( x instanceof Integer ) return PGInteger.castToServerType((Integer)x, targetType ); if ( x instanceof Long ) return PGLong.castToServerType((Long)x, targetType ); if ( x instanceof Double ) return PGDouble.castToServerType((Double)x, targetType ); if ( x instanceof Float ) return PGFloat.castToServerType((Float)x, targetType ); if ( x instanceof BigDecimal) return PGBigDecimal.castToServerType((BigDecimal)x, targetType ); // since all of the above are instances of Number make sure this is after them if ( x instanceof Number ) return PGNumber.castToServerType((Number)x, targetType ); if ( x instanceof Boolean) return PGBoolean.castToServerType((Boolean)x, targetType ); return new PGUnknown(x); } // Helper method for setting parameters to PGobject subclasses.
private PGType createInternalType( Object x, int targetType ) throws PSQLException { if ( x instanceof Byte ) return PGByte.castToServerType((Byte)x, targetType ); if ( x instanceof Short ) return PGShort.castToServerType((Short)x, targetType ); if ( x instanceof Integer ) return PGInteger.castToServerType((Integer)x, targetType ); if ( x instanceof Long ) return PGLong.castToServerType((Long)x, targetType ); if ( x instanceof Double ) return PGDouble.castToServerType((Double)x, targetType ); if ( x instanceof Float ) return PGFloat.castToServerType((Float)x, targetType ); if ( x instanceof BigDecimal) return PGBigDecimal.castToServerType((BigDecimal)x, targetType ); // since all of the above are instances of Number make sure this is after them if ( x instanceof Number ) return PGNumber.castToServerType((Number)x, targetType ); if ( x instanceof Boolean) return PGBoolean.castToServerType((Boolean)x, targetType ); return new PGUnknown(x); } // Helper method for setting parameters to PGobject subclasses.