/** * Return the portion of the select statement between the SELECT keyword * and the FROM keyword. */ protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate) { // append the aliases for all the columns SQLBuffer selectSQL = new SQLBuffer(this); List aliases; if (distinctIdentifiers) aliases = sel.getIdentifierAliases(); else aliases = sel.getSelectAliases(); Object alias; for (int i = 0; i < aliases.size(); i++) { alias = aliases.get(i); appendSelect(selectSQL, alias, sel, i); if (i < aliases.size() - 1) selectSQL.append(", "); } return selectSQL; }
/** * Return the portion of the select statement between the SELECT keyword * and the FROM keyword. */ protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate) { // append the aliases for all the columns SQLBuffer selectSQL = new SQLBuffer(this); List aliases; if (distinctIdentifiers) aliases = sel.getIdentifierAliases(); else aliases = sel.getSelectAliases(); Object alias; for (int i = 0; i < aliases.size(); i++) { alias = aliases.get(i); if (alias instanceof String) { alias = getNamingUtil().convertAlias((String)alias); } appendSelect(selectSQL, alias, sel, i); if (i < aliases.size() - 1) selectSQL.append(", "); } return selectSQL; }
/** * Return the portion of the select statement between the SELECT keyword * and the FROM keyword. */ protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate) { // append the aliases for all the columns SQLBuffer selectSQL = new SQLBuffer(this); List aliases; if (distinctIdentifiers) aliases = sel.getIdentifierAliases(); else aliases = sel.getSelectAliases(); Object alias; for (int i = 0; i < aliases.size(); i++) { alias = aliases.get(i); if (alias instanceof String) { alias = getNamingUtil().convertAlias((String)alias); } appendSelect(selectSQL, alias, sel, i); if (i < aliases.size() - 1) selectSQL.append(", "); } return selectSQL; }
/** * Return the portion of the select statement between the SELECT keyword * and the FROM keyword. */ protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate) { // append the aliases for all the columns SQLBuffer selectSQL = new SQLBuffer(this); List aliases; if (distinctIdentifiers) aliases = sel.getIdentifierAliases(); else aliases = sel.getSelectAliases(); Object alias; for (int i = 0; i < aliases.size(); i++) { alias = aliases.get(i); if (alias instanceof String) { alias = getNamingUtil().convertAlias((String)alias); } appendSelect(selectSQL, alias, sel, i); if (i < aliases.size() - 1) selectSQL.append(", "); } return selectSQL; }
/** * Return the portion of the select statement between the SELECT keyword * and the FROM keyword. */ protected SQLBuffer getSelects(Select sel, boolean distinctIdentifiers, boolean forUpdate) { // append the aliases for all the columns SQLBuffer selectSQL = new SQLBuffer(this); List aliases; if (distinctIdentifiers) aliases = sel.getIdentifierAliases(); else aliases = sel.getSelectAliases(); Object alias; for (int i = 0; i < aliases.size(); i++) { alias = aliases.get(i); if (alias instanceof String) { alias = getNamingUtil().convertAlias((String)alias); } appendSelect(selectSQL, alias, sel, i); if (i < aliases.size() - 1) selectSQL.append(", "); } return selectSQL; }
@Override 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("(" + characterColumnSize + ")"); selectSQL.append(")"); } }
@Override 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("(" + characterColumnSize + ")"); selectSQL.append(")"); } }
@Override 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("(" + characterColumnSize + ")"); selectSQL.append(")"); } }
@Override 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("(" + characterColumnSize + ")"); selectSQL.append(")"); } }