use of org.apache.cayenne.exp.parser.ASTNotEqual in project cayenne by apache.
the class DB2QualifierTranslator method processColumnWithQuoteSqlIdentifiers.
@Override
protected void processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr, Expression pathExp) {
SimpleNode parent = null;
if (pathExp instanceof SimpleNode) {
parent = (SimpleNode) ((SimpleNode) pathExp).jjtGetParent();
}
// 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);
}
}
use of org.apache.cayenne.exp.parser.ASTNotEqual in project cayenne by apache.
the class DerbyQualifierTranslator method processColumnWithQuoteSqlIdentifiers.
@Override
protected void processColumnWithQuoteSqlIdentifiers(DbAttribute dbAttr, Expression pathExp) {
SimpleNode parent = null;
if (pathExp instanceof SimpleNode) {
parent = (SimpleNode) ((SimpleNode) pathExp).jjtGetParent();
}
// 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);
}
}
Aggregations