private bool IsSameProjection(ShorthandProjection shorthandProjection, ColumnOrderByItemSegment orderItem, SelectCommand selectCommand)
        {
            if (shorthandProjection.GetOwner() == null)
            {
                throw new ShardingException("shorthandProjection can not found owner");
            }
            SimpleTableSegment tableSegment = Find(shorthandProjection.GetOwner(), selectCommand);

            return(_schemaMetaData.ContainsColumn(tableSegment.GetTableName().GetIdentifier().GetValue(), orderItem.GetColumn().GetIdentifier().GetValue()));
        }
 private bool IsTable(SimpleTableSegment owner, ICollection <SimpleTableSegment> tableSegments)
 {
     foreach (var simpleTableSegment in tableSegments)
     {
         if (owner.GetTableName().GetIdentifier().GetValue().Equals(simpleTableSegment.GetAlias()))
         {
             return(false);
         }
     }
     return(true);
 }
        private ShorthandProjection FindShorthandProjection(ICollection <IProjection> projections, string tableNameOrAlias, SelectCommand selectCommand)
        {
            SimpleTableSegment tableSegment = Find(tableNameOrAlias, selectCommand);

            foreach (var projection in projections)
            {
                if (!(projection is ShorthandProjection))
                {
                    continue;
                }
                ShorthandProjection shorthandProjection = (ShorthandProjection)projection;
                if (shorthandProjection.GetOwner() != null && Find(
                        shorthandProjection.GetOwner(), selectCommand).GetTableName().GetIdentifier().GetValue().Equals(tableSegment.GetTableName().GetIdentifier().GetValue(), StringComparison.OrdinalIgnoreCase))
                {
                    return(shorthandProjection);
                }
            }
            return(null);
        }