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()));
        }
Пример #2
0
        /// <summary>
        /// 通过元信息获取表名
        /// </summary>
        /// <param name="columnName"></param>
        /// <param name="schemaMetaData"></param>
        /// <returns></returns>
        private string FindTableNameFromMetaData(string columnName, SchemaMetaData schemaMetaData)
        {
            foreach (var table in _tables)
            {
                if (schemaMetaData.ContainsColumn(table.GetTableName().GetIdentifier().GetValue(), columnName))
                {
                    return(table.GetTableName().GetIdentifier().GetValue());
                }
            }

            return(null);
        }