コード例 #1
0
 public LiteralParseNode coerce(LiteralParseNode literalNode, PDataType expectedType)
     throws SQLException {
   PDataType actualType = literalNode.getType();
   if (actualType != null) {
     Object before = literalNode.getValue();
     checkTypeMatch(expectedType, actualType);
     Object after = expectedType.toObject(before, actualType);
     if (before != after) {
       literalNode = literal(after);
     }
   }
   return literalNode;
 }
コード例 #2
0
 @Override
 public Expression visit(LiteralParseNode node) throws SQLException {
   if (isTopLevel()) {
     return LiteralExpression.newConstant(
         node.getValue(), column.getDataType(), column.getColumnModifier());
   }
   return super.visit(node);
 }