/** * 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 + "(" + characterColumnSize + ")"; fstring = "CAST(? AS " + type + ")"; return fstring; }
val.appendTo(buf); buf.append(mid); buf.append(getTypeName(type)); appendLength(buf, type); buf.append(post); if (sqlString.endsWith("?")) { String typeName = getTypeName(type); if (String.class.equals(val.getType())) typeName = typeName + "(" + characterColumnSize + ")";
val.appendTo(buf); buf.append(mid); buf.append(getTypeName(type)); appendLength(buf, type); buf.append(post); if (sqlString.endsWith("?")) { String typeName = getTypeName(type); if (String.class.equals(val.getType())) typeName = typeName + "(" + getCastStringColumnSize(val) + ")";
val.appendTo(buf); buf.append(mid); buf.append(getTypeName(type)); appendLength(buf, type); buf.append(post); if (sqlString.endsWith("?")) { String typeName = getTypeName(type); if (String.class.equals(val.getType())) typeName = typeName + "(" + getCastStringColumnSize(val) + ")";
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); if (val instanceof Lit) selectSQL.append("CAST("); // ... and add the select per super's behavior... super.appendSelect(selectSQL, alias, sel, idx); // ... and finish the cast if (val instanceof Lit) { 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("(" + characterColumnSize + ")"); selectSQL.append(")"); } }
/** * 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; }
val.appendTo(buf); buf.append(mid); buf.append(getTypeName(type)); appendLength(buf, type); buf.append(post); if (sqlString.endsWith("?")) { String typeName = getTypeName(type); if (String.class.equals(val.getType())) typeName = typeName + "(" + getCastStringColumnSize(val) + ")";
/** * 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; }
val.appendTo(buf); buf.append(mid); buf.append(getTypeName(type)); appendLength(buf, type); buf.append(post); if (sqlString.endsWith("?")) { String typeName = getTypeName(type); if (String.class.equals(val.getType())) typeName = typeName + "(" + getCastStringColumnSize(val) + ")";
/** * 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; }
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(")"); } }