use of com.developmentontheedge.sql.model.AstDateAdd in project be5 by DevelopmentOnTheEdge.
the class MySqlTransformer method transformDateAdd.
@Override
protected void transformDateAdd(AstFunNode node) {
Function opTimes = DefaultParserContext.FUNC_TIMES;
SimpleNode date = node.child(0);
SimpleNode number = node.child(1);
String name = node.getFunction().getName();
String type = name.equalsIgnoreCase("add_months") ? "MONTH" : name.equalsIgnoreCase("add_days") ? "DAY" : "MICROSECOND";
if (type.equals("MICROSECOND"))
number = new AstParenthesis(opTimes.node(number, AstNumericConstant.of(1000)));
node.replaceWith(new AstDateAdd(date, new AstInterval(number), type));
}
Aggregations