public override IASTNode VisitAssignment(SqlServerCommandParser.AssignmentContext context) { ColumnSegment column = (ColumnSegment)VisitColumnName(context.columnName()); var value = (IExpressionSegment)Visit(context.assignmentValue()); return(new AssignmentSegment(context.Start.StartIndex, context.Stop.StopIndex, column, value)); }
public RenameColumnSegment(int startIndex, int stopIndex, ColumnSegment oldColumnName, ColumnSegment columnName) { this._startIndex = startIndex; this._stopIndex = stopIndex; OldColumnName = oldColumnName; ColumnName = columnName; }
private PredicateSegment CreateInSegment(SqlServerCommandParser.PredicateContext context) { ColumnSegment column = (ColumnSegment)Visit(context.bitExpr(0)); PredicateBracketValue predicateBracketValue = CreateBracketValue(context); return(new PredicateSegment(context.Start.StartIndex, context.Stop.StopIndex, column, new PredicateInRightValue(predicateBracketValue, GetExpressionSegments(context)))); }
public PredicateSegment(int startIndex, int stopIndex, ColumnSegment column, IPredicateRightValue rightValue) { _startIndex = startIndex; _stopIndex = stopIndex; _column = column; _rightValue = rightValue; }
public override IASTNode VisitAssignment(MySqlCommandParser.AssignmentContext ctx) { ColumnSegment column = (ColumnSegment)VisitColumnName(ctx.columnName()); IExpressionSegment value = (IExpressionSegment)Visit(ctx.assignmentValue()); return(new AssignmentSegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, column, value)); }
private PredicateSegment CreateBetweenSegment(SqlServerCommandParser.PredicateContext context) { ColumnSegment column = (ColumnSegment)Visit(context.bitExpr(0)); IExpressionSegment between = (IExpressionSegment)Visit(context.bitExpr(1)); IExpressionSegment and = (IExpressionSegment)Visit(context.predicate()); return(new PredicateSegment(context.Start.StartIndex, context.Stop.StopIndex, column, new PredicateBetweenRightValue(between, and))); }
public override IASTNode VisitColumnName(MySqlCommandParser.ColumnNameContext ctx) { ColumnSegment result = new ColumnSegment(ctx.Start.StartIndex, ctx.Stop.StopIndex, (IdentifierValue)Visit(ctx.name())); MySqlCommandParser.OwnerContext owner = ctx.owner(); if (null != owner) { result.SetOwner(new OwnerSegment(owner.Start.StartIndex, owner.Stop.StopIndex, (IdentifierValue)Visit(owner.identifier()))); } return(result); }
protected void PopulateColumnsSegments() { const string QUERY_COLUMNS_SEGMENTS = @" SELECT DIMENSION_NAME AS TABLE_NAME, PARTITION_NAME, COLUMN_ID AS COLUMN_NAME, SEGMENT_NUMBER, TABLE_PARTITION_NUMBER, RECORDS_COUNT AS SEGMENT_ROWS, USED_SIZE, COMPRESSION_TYPE, BITS_COUNT, BOOKMARK_BITS_COUNT, VERTIPAQ_STATE FROM $SYSTEM.DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS WHERE RIGHT ( LEFT ( TABLE_ID, 2 ), 1 ) <> '$'"; var cmd = new AdomdCommand(QUERY_COLUMNS_SEGMENTS, Connection) { CommandTimeout = CommandTimeout }; using (var rdr = cmd.ExecuteReader()) { while (rdr.Read()) { string tableName = rdr.GetString(0); string partitionName = rdr.GetString(1); string columnDmv1100Id = rdr.GetString(2); long segmentNumber = rdr.GetInt64(3); long tablePartitionNumber = rdr.GetInt64(4); long segmentRows = rdr.GetInt64(5); long usedSize = (long)rdr.GetDecimal(6); string compressionType = rdr.GetString(7); long bitsCount = rdr.GetInt64(8); long bookmarkBitsCount = rdr.GetInt64(9); string vertipaqState = rdr.GetString(10); // Column daxColumn = GetDaxColumnDmv1100Id(tableName, columnDmv1100Id); ColumnSegment daxColumnSegment = GetDaxColumnSegment(tableName, partitionName, columnDmv1100Id, segmentNumber, tablePartitionNumber); daxColumnSegment.BitsCount = bitsCount; daxColumnSegment.BookmarkBitsCount = bookmarkBitsCount; daxColumnSegment.CompressionType = compressionType; daxColumnSegment.SegmentRows = segmentRows; daxColumnSegment.UsedSize = usedSize; daxColumnSegment.VertipaqState = vertipaqState; } } }
public override IASTNode VisitOrderByItem(SqlServerCommandParser.OrderByItemContext context) { OrderDirectionEnum orderDirection = null != context.DESC() ? OrderDirectionEnum.DESC : OrderDirectionEnum.ASC; if (null != context.columnName()) { ColumnSegment column = (ColumnSegment)Visit(context.columnName()); return(new ColumnOrderByItemSegment(column, orderDirection)); } if (null != context.numberLiterals()) { return(new IndexOrderByItemSegment(context.numberLiterals().Start.StartIndex, context.numberLiterals().Stop.StopIndex, (int)SqlUtil.GetExactlyNumber(context.numberLiterals().GetText(), 10), orderDirection)); } return(new ExpressionOrderByItemSegment(context.expr().Start.StartIndex, context.expr().Stop.StopIndex, context.expr().GetText(), orderDirection)); }
public override IASTNode VisitProjection(SqlServerCommandParser.ProjectionContext context) { // FIXME :The stop index of project is the stop index of projection, instead of alias. if (null != context.qualifiedShorthand()) { var shorthand = context.qualifiedShorthand(); var result = new ShorthandProjectionSegment(shorthand.Start.StartIndex, shorthand.Stop.StopIndex); IdentifierValue identifier = new IdentifierValue(shorthand.identifier().GetText()); result.SetOwner(new OwnerSegment(shorthand.identifier().Start.StartIndex, shorthand.identifier().Stop.StopIndex, identifier)); return(result); } AliasSegment alias = null == context.alias() ? null : (AliasSegment)Visit(context.alias()); if (null != context.columnName()) { ColumnSegment column = (ColumnSegment)Visit(context.columnName()); ColumnProjectionSegment result = new ColumnProjectionSegment(column); result.SetAlias(alias); return(result); } return(CreateProjection(context, alias)); }
public ColumnFirstPositionSegment(int startIndex, int stopIndex, ColumnSegment columnName) : base(startIndex, stopIndex, columnName) { }
public ColumnOrderByItemSegment(ColumnSegment column, OrderDirectionEnum orderDirection) : base(column.GetStartIndex(), column.GetStopIndex(), orderDirection, OrderDirectionEnum.ASC) { this._column = column; }
public ColumnPositionSegment(int startIndex, int stopIndex, ColumnSegment columnName) { this._startIndex = startIndex; this._stopIndex = stopIndex; ColumnName = columnName; }