/** * add CAST for a function operator where operand is a param * * @param func function name * @param val type * @return updated string (func) */ public String addCastAsType(String func, Val val) { String fstring = null; String type = getTypeName(getJDBCType(JavaTypes.getTypeCode(val .getType()), false)); if (String.class.equals(val.getType())) type = type + "(" + getCastStringColumnSize(val) + ")"; fstring = "CAST(? AS " + type + ")"; return fstring; }
/** * add CAST for a function operator where operand is a param * * @param func function name * @param val type * @return updated string (func) */ public String addCastAsType(String func, Val val) { String fstring = null; String type = getTypeName(getJDBCType(JavaTypes.getTypeCode(val .getType()), false)); if (String.class.equals(val.getType())) type = type + "(" + getCastStringColumnSize(val) + ")"; fstring = "CAST(? AS " + type + ")"; return fstring; }
/** * add CAST for a function operator where operand is a param * * @param func function name * @param val type * @return updated string (func) */ public String addCastAsType(String func, Val val) { String fstring = null; String type = getTypeName(getJDBCType(JavaTypes.getTypeCode(val .getType()), false)); if (String.class.equals(val.getType())) type = type + "(" + getCastStringColumnSize(val) + ")"; fstring = "CAST(? AS " + type + ")"; return fstring; }
/** * add CAST for a function operator where operand is a param * * @param func function name * @param val type * @return updated string (func) */ public String addCastAsType(String func, Val val) { String fstring = null; String type = getTypeName(getJDBCType(JavaTypes.getTypeCode(val .getType()), false)); if (String.class.equals(val.getType())) type = type + "(" + getCastStringColumnSize(val) + ")"; fstring = "CAST(? AS " + type + ")"; return fstring; }
typeName = typeName + "(" + getCastStringColumnSize(val) + ")"; String str = "CAST(? AS " + typeName + ")"; buf.replaceSqlString(sqlString.length() - 1,
typeName = typeName + "(" + getCastStringColumnSize(val) + ")"; String str = "CAST(? AS " + typeName + ")"; buf.replaceSqlString(sqlString.length() - 1,
typeName = typeName + "(" + getCastStringColumnSize(val) + ")"; String str = "CAST(? AS " + typeName + ")"; buf.replaceSqlString(sqlString.length() - 1,
typeName = typeName + "(" + getCastStringColumnSize(val) + ")"; String str = "CAST(? AS " + typeName + ")"; buf.replaceSqlString(sqlString.length() - 1,
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel, int idx) { // if this is a literal value, add a cast... Object val = sel.getSelects().get(idx); boolean toCast = (val instanceof Lit) && ((Lit)val).getParseType() != Literal.TYPE_DATE && ((Lit)val).getParseType() != Literal.TYPE_TIME && ((Lit)val).getParseType() != Literal.TYPE_TIMESTAMP; if (toCast) selectSQL.append("CAST("); // ... and add the select per super's behavior... super.appendSelect(selectSQL, alias, sel, idx); // ... and finish the cast if (toCast) { Class<?> c = ((Lit) val).getType(); int javaTypeCode = JavaTypes.getTypeCode(c); int jdbcTypeCode = getJDBCType(javaTypeCode, false); String typeName = getTypeName(jdbcTypeCode); selectSQL.append(" AS " + typeName); // if the literal is a string, use the default char col size // in the cast statement. if (String.class.equals(c)) selectSQL.append("(" + getCastStringColumnSize(val) + ")"); selectSQL.append(")"); } }
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel, int idx) { // if this is a literal value, add a cast... Object val = sel.getSelects().get(idx); boolean toCast = (val instanceof Lit) && ((Lit)val).getParseType() != Literal.TYPE_DATE && ((Lit)val).getParseType() != Literal.TYPE_TIME && ((Lit)val).getParseType() != Literal.TYPE_TIMESTAMP; if (toCast) selectSQL.append("CAST("); // ... and add the select per super's behavior... super.appendSelect(selectSQL, alias, sel, idx); // ... and finish the cast if (toCast) { Class<?> c = ((Lit) val).getType(); int javaTypeCode = JavaTypes.getTypeCode(c); int jdbcTypeCode = getJDBCType(javaTypeCode, false); String typeName = getTypeName(jdbcTypeCode); selectSQL.append(" AS " + typeName); // if the literal is a string, use the default char col size // in the cast statement. if (String.class.equals(c)) selectSQL.append("(" + getCastStringColumnSize(val) + ")"); selectSQL.append(")"); } }
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel, int idx) { // if this is a literal value, add a cast... Object val = sel.getSelects().get(idx); boolean toCast = (val instanceof Lit) && ((Lit)val).getParseType() != Literal.TYPE_DATE && ((Lit)val).getParseType() != Literal.TYPE_TIME && ((Lit)val).getParseType() != Literal.TYPE_TIMESTAMP; if (toCast) selectSQL.append("CAST("); // ... and add the select per super's behavior... super.appendSelect(selectSQL, alias, sel, idx); // ... and finish the cast if (toCast) { Class<?> c = ((Lit) val).getType(); int javaTypeCode = JavaTypes.getTypeCode(c); int jdbcTypeCode = getJDBCType(javaTypeCode, false); String typeName = getTypeName(jdbcTypeCode); selectSQL.append(" AS " + typeName); // if the literal is a string, use the default char col size // in the cast statement. if (String.class.equals(c)) selectSQL.append("(" + getCastStringColumnSize(val) + ")"); selectSQL.append(")"); } }
protected void appendSelect(SQLBuffer selectSQL, Object alias, Select sel, int idx) { // if this is a literal value, add a cast... Object val = sel.getSelects().get(idx); boolean toCast = (val instanceof Lit) && ((Lit)val).getParseType() != Literal.TYPE_DATE && ((Lit)val).getParseType() != Literal.TYPE_TIME && ((Lit)val).getParseType() != Literal.TYPE_TIMESTAMP; if (toCast) selectSQL.append("CAST("); // ... and add the select per super's behavior... super.appendSelect(selectSQL, alias, sel, idx); // ... and finish the cast if (toCast) { Class<?> c = ((Lit) val).getType(); int javaTypeCode = JavaTypes.getTypeCode(c); int jdbcTypeCode = getJDBCType(javaTypeCode, false); String typeName = getTypeName(jdbcTypeCode); selectSQL.append(" AS " + typeName); // if the literal is a string, use the default char col size // in the cast statement. if (String.class.equals(c)) selectSQL.append("(" + getCastStringColumnSize(val) + ")"); selectSQL.append(")"); } }