public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { // per the SQL std, each string fragment must be on a different line final List<SqlNode> operandList = call.getOperandList(); for (int i = 1; i < operandList.size(); i++) { SqlParserPos prevPos = operandList.get(i - 1).getParserPosition(); final SqlNode operand = operandList.get(i); SqlParserPos pos = operand.getParserPosition(); if (pos.getLineNum() <= prevPos.getLineNum()) { throw validator.newValidationError(operand, RESOURCE.stringFragsOnSameLine()); } } }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { // per the SQL std, each string fragment must be on a different line for (int i = 1; i < call.operands.length; i++) { SqlParserPos prevPos = call.operands[i - 1].getParserPosition(); final SqlNode operand = call.operands[i]; SqlParserPos pos = operand.getParserPosition(); if (pos.getLineNum() <= prevPos.getLineNum()) { throw validator.newValidationError( operand, EigenbaseResource.instance().StringFragsOnSameLine.ex()); } } }
/** * Creates a new ValidateErrorInfo with a SqlParserPos and an error * string. * * @param pos Error position * @param errorMsg Error message */ public ValidateErrorInfo( SqlParserPos pos, String errorMsg) { this.startLineNum = pos.getLineNum(); this.startColumnNum = pos.getColumnNum(); this.endLineNum = pos.getEndLineNum(); this.endColumnNum = pos.getEndColumnNum(); this.errorMsg = errorMsg; }
/** * Creates a new ValidateErrorInfo with a SqlParserPos and an error * string. * * @param pos Error position * @param errorMsg Error message */ public ValidateErrorInfo( SqlParserPos pos, String errorMsg) { this.startLineNum = pos.getLineNum(); this.startColumnNum = pos.getColumnNum(); this.endLineNum = pos.getEndLineNum(); this.endColumnNum = pos.getEndColumnNum(); this.errorMsg = errorMsg; }
/** * Combines this parser position with another to create a position which * spans from the first point in the first to the last point in the other. */ public SqlParserPos plus(SqlParserPos pos) { return new SqlParserPos( getLineNum(), getColumnNum(), pos.getEndLineNum(), pos.getEndColumnNum()); }
/** * Wraps an exception with context. */ public static EigenbaseContextException newContextException( final SqlParserPos pos, Resources.ExInst<?> e) { int line = pos.getLineNum(); int col = pos.getColumnNum(); int endLine = pos.getEndLineNum(); int endCol = pos.getEndColumnNum(); return newContextException(line, col, endLine, endCol, e); }
/** * Combines this parser position with an array of positions to create a * position which spans from the first point in the first to the last point * in the other. */ public SqlParserPos plusAll(SqlNode [] nodes) { int line = getLineNum(); int column = getColumnNum(); int endLine = getEndLineNum(); int endColumn = getEndColumnNum(); return sum(nodes, line, column, endLine, endColumn); }
/** * Wraps an exception with context. */ public static EigenbaseException newContextException( final SqlParserPos pos, Throwable e) { int line = pos.getLineNum(); int col = pos.getColumnNum(); int endLine = pos.getEndLineNum(); int endCol = pos.getEndColumnNum(); return newContextException(line, col, endLine, endCol, e); }
/** * Combines this parser position with another to create a position which * spans from the first point in the first to the last point in the other. */ public SqlParserPos plus(SqlParserPos pos) { return new SqlParserPos( getLineNum(), getColumnNum(), pos.getEndLineNum(), pos.getEndColumnNum()); }
/** * Combines this parser position with an array of positions to create a * position which spans from the first point in the first to the last point * in the other. */ public SqlParserPos plusAll(SqlNode[] nodes) { int line = getLineNum(); int column = getColumnNum(); int endLine = getEndLineNum(); int endColumn = getEndColumnNum(); return sum(nodes, line, column, endLine, endColumn); }
public int compare(SqlNode o1, SqlNode o2) { final SqlParserPos pos0 = o1.getParserPosition(); final SqlParserPos pos1 = o2.getParserPosition(); int c = -Utilities.compare( pos0.getLineNum(), pos1.getLineNum()); if (c != 0) { return c; } return -Utilities.compare( pos0.getColumnNum(), pos1.getColumnNum()); } });
continue; testLine = pos.getLineNum(); testColumn = pos.getColumnNum(); if (testLine < line || testLine == line && testColumn < column) {
continue; testLine = pos.getLineNum(); testColumn = pos.getColumnNum(); if (testLine < line || testLine == line && testColumn < column) {
final int start = SqlParserUtil.lineColToIndex( sql, pos.getLineNum(), pos.getColumnNum()); final int end = SqlParserUtil.lineColToIndex(
actualLine = spe.getPos().getLineNum(); actualColumn = spe.getPos().getColumnNum(); actualEndLine = spe.getPos().getEndLineNum(); } else if ( (sap.pos != null) && ((actualLine != sap.pos.getLineNum()) || (actualColumn != sap.pos.getColumnNum()) || (actualEndLine != sap.pos.getEndLineNum())
actualLine = spe.getPos().getLineNum(); actualColumn = spe.getPos().getColumnNum(); actualEndLine = spe.getPos().getEndLineNum(); } else if ( (sap.pos != null) && ((actualLine != sap.pos.getLineNum()) || (actualColumn != sap.pos.getColumnNum()) || (actualEndLine != sap.pos.getEndLineNum())
protected void validateFeature( ResourceDefinition feature, SqlParserPos context) { if (feature == disabledFeature) { EigenbaseException ex = new EigenbaseException( FEATURE_DISABLED, null); if (context == null) { throw ex; } throw new EigenbaseContextException( "location", ex, context.getLineNum(), context.getColumnNum(), context.getEndLineNum(), context.getEndColumnNum()); } } }
continue; testLine = pos.getLineNum(); testColumn = pos.getColumnNum(); if ((testLine < line) continue; testLine = pos.getLineNum(); testColumn = pos.getColumnNum(); if ((testLine < line)
protected void validateFeature( Feature feature, SqlParserPos context) { if (feature.equals(disabledFeature)) { EigenbaseException ex = new EigenbaseException( FEATURE_DISABLED, null); if (context == null) { throw ex; } throw new EigenbaseContextException( "location", ex, context.getLineNum(), context.getColumnNum(), context.getEndLineNum(), context.getEndColumnNum()); } } }