/** * For registering specific output parameter types we need to translate these into the appropriate * java.sql.Types output parameters * We will need to match these up with the appropriate standard sql types * @param cstmt * @param parameter * @throws SQLException */ protected void registerSpecificTypeOfOutParameter(CallableStatement statement, Class<?> runtimeType, int index) throws SQLException { int typeToSet = TypeFacility.getSQLTypeFromRuntimeType(runtimeType); statement.registerOutParameter(index,typeToSet); }
@Override public void bindValue(PreparedStatement pstmt, Object param, Class<?> paramType, int i) throws SQLException { int type = TypeFacility.getSQLTypeFromRuntimeType(paramType);
int type = TypeFacility.getSQLTypeFromRuntimeType(paramType);
public String getCreateTempTableSQL(String name, List<ColumnReference> cols, boolean transactional) { SQLDialect d = getDialect(); StringBuilder sb = new StringBuilder(getCreateTemporaryTableString(transactional)).append(" "); //$NON-NLS-1$ sb.append(name).append(" ("); //$NON-NLS-1$ for (Iterator<ColumnReference> iter = cols.iterator(); iter.hasNext();) { ColumnReference col = iter.next(); sb.append(col.getName()); sb.append(" "); //$NON-NLS-1$ Integer defaultValue = JDBCSQLTypeInfo.getDefaultPrecision(col.getType()); int precision = defaultValue == null?255:defaultValue; int scale = col.getType() == TypeFacility.RUNTIME_TYPES.BIG_DECIMAL?2:0; long length = precision; if (col.getMetadataObject() != null) { precision = col.getMetadataObject().getPrecision(); scale = col.getMetadataObject().getScale(); length = col.getMetadataObject().getLength(); } sb.append(d.getTypeName(TypeFacility.getSQLTypeFromRuntimeType(col.getType()), length, precision, scale)); //sb.append(" NOT NULL"); -- needed if we will add an index if (iter.hasNext()) { sb.append(", "); //$NON-NLS-1$ } } sb.append(") "); if (getCreateTemporaryTablePostfix(transactional) != null) { sb.append(getCreateTemporaryTablePostfix(transactional)); } String sql = sb.toString(); return sql; }