Example #1
0
 /**
  * Finds an aggregate.
  *
  * @param node Parse tree to search
  * @return First aggregate function in parse tree, or null if not found
  */
 public SqlNode findAgg(SqlNode node) {
   try {
     node.accept(this);
     return null;
   } catch (Util.FoundOne e) {
     Util.swallow(e, null);
     return (SqlNode) e.getNode();
   }
 }
 /** Clones a SqlNode with a different position. */
 public SqlNode clone(SqlParserPos pos) {
   // REVIEW jvs 26-July-2006:  shouldn't pos be used here?  Or are
   // subclasses always supposed to override, in which case this
   // method should probably be abstract?
   try {
     return (SqlNode) super.clone();
   } catch (CloneNotSupportedException e) {
     throw Util.newInternal(e, "error while cloning " + this);
   }
 }
 /**
  * Validates this node in an expression context.
  *
  * <p>Usually, this method does much the same as {@link #validate}, but a {@link SqlIdentifier}
  * can occur in expression and non-expression contexts.
  */
 public void validateExpr(SqlValidator validator, SqlValidatorScope scope) {
   validate(validator, scope);
   Util.discard(validator.deriveType(scope, this));
 }
 /**
  * Creates a node.
  *
  * @param pos Parser position, must not be null.
  */
 SqlNode(SqlParserPos pos) {
   Util.pre(pos != null, "pos != null");
   this.pos = pos;
 }
 public String getSignatureTemplate(final int operandsCount) {
   Util.discard(operandsCount);
   return "{1} {0} {2} AND {3}";
 }