@Override protected void processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr, Expression pathExp) { SimpleNode parent = null; if (pathExp instanceof SimpleNode) { parent = (SimpleNode) ((SimpleNode) pathExp).jjtGetParent(); } // problem in derby : Comparisons between 'CLOB (UCS_BASIC)' and 'CLOB // (UCS_BASIC)' are not supported. // we need do it by casting the Clob to VARCHAR. if (parent != null && (parent instanceof ASTEqual || parent instanceof ASTNotEqual) && dbAttr.getType() == Types.CLOB && parent.getOperandCount() == 2 && parent.getOperand(1) instanceof String) { Integer size = parent.getOperand(1).toString().length() + 1; out.append("CAST("); super.processColumnWithQuoteSqlIdentifiers(dbAttr, pathExp); out.append(" AS VARCHAR(").append(size).append("))"); } else { super.processColumnWithQuoteSqlIdentifiers(dbAttr, pathExp); } }
@Override protected void processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr, Expression pathExp) { SimpleNode parent = null; if (pathExp instanceof SimpleNode) { parent = (SimpleNode) ((SimpleNode) pathExp).jjtGetParent(); } // problem in db2 : Comparisons between CLOB and CLOB are not supported. // we need do it by casting the Clob to VARCHAR. if (parent != null && (parent instanceof ASTEqual || parent instanceof ASTNotEqual) && dbAttr.getType() == Types.CLOB && parent.getOperandCount() == 2 && parent.getOperand(1) instanceof String) { Integer size = parent.getOperand(1).toString().length() + 1; out.append("CAST("); super.processColumnWithQuoteSqlIdentifiers(dbAttr, pathExp); out.append(" AS VARCHAR(" + size + "))"); } else { super.processColumnWithQuoteSqlIdentifiers(dbAttr, pathExp); } }
private ASTObjPath findPeerPath(SimpleNode exp, Object child) { if (exp == null) { return null; } if (!(exp instanceof ConditionNode)) { return findPeerPath((SimpleNode) exp.jjtGetParent(), exp); } // terminate walk up at a ConditionNode, start a walk down int len = exp.getOperandCount(); for (int i = 0; i < len; i++) { Object operand = exp.getOperand(i); if (operand == child || !(operand instanceof Expression)) { continue; } ASTObjPath path = findChildPath((Expression) operand); if (path != null) { return path; } } return null; }
Expression parent = (Expression) ((SimpleNode) e).jjtGetParent(); if (parent != null) { return paramsDbType(parent);
Expression parent = (Expression) ((SimpleNode) e).jjtGetParent(); if (parent != null) { return paramsDbType(parent);