}
if (type == QueryConstants.OPERATION_BETWEEN)
{
AndQueryNode between = factory.createAndQueryNode(parent);
RelationQueryNode rel =
createRelationQueryNode(between, identifier, QueryConstants.OPERATION_GE_GENERAL,
(ASTLiteral)node.children[1]);
node.childrenAccept(this, rel);
between.addOperand(rel);
rel =
createRelationQueryNode(between, identifier, QueryConstants.OPERATION_LE_GENERAL,
(ASTLiteral)node.children[2]);
node.childrenAccept(this, rel);
between.addOperand(rel);
predicateNode = between;
}
else if (type == QueryConstants.OPERATION_GE_GENERAL || type == QueryConstants.OPERATION_GT_GENERAL
|| type == QueryConstants.OPERATION_LE_GENERAL || type == QueryConstants.OPERATION_LT_GENERAL
|| type == QueryConstants.OPERATION_NE_GENERAL || type == QueryConstants.OPERATION_EQ_GENERAL)
{
predicateNode = createRelationQueryNode(parent, identifier, type, value[0]);
node.childrenAccept(this, predicateNode);
}
else if (type == QueryConstants.OPERATION_LIKE)
{
ASTLiteral pattern = value[0];
if (node.getEscapeString() != null)
{
if (node.getEscapeString().length() == 1)
{
// backslash is the escape character we use internally
pattern.setValue(translateEscaping(pattern.getValue(), node.getEscapeString().charAt(0), '\\'));
}
else
{
throw new IllegalArgumentException("ESCAPE string value must have length 1: '"
+ node.getEscapeString() + "'");
}
}
else
{
// no escape character specified.
// if the pattern contains any backslash characters we need
// to escape them.
pattern.setValue(pattern.getValue().replaceAll("\\\\", "\\\\\\\\"));
}
predicateNode = createRelationQueryNode(parent, identifier, type, pattern);
node.childrenAccept(this, predicateNode);
}
else if (type == QueryConstants.OPERATION_IN)
{
OrQueryNode in = factory.createOrQueryNode(parent);
for (int i = 1; i < node.children.length; i++)
{
RelationQueryNode rel =
createRelationQueryNode(in, identifier, QueryConstants.OPERATION_EQ_VALUE,
(ASTLiteral)node.children[i]);
node.childrenAccept(this, rel);
in.addOperand(rel);
}