示例#1
0
        internal Table(Command command, TableMD tableMetadata, int tableId)
        {
            m_tableMetadata      = tableMetadata;
            m_columns            = Command.CreateVarList();
            m_keys               = command.CreateVarVec();
            m_nonnullableColumns = command.CreateVarVec();
            m_tableId            = tableId;

            Dictionary <string, ColumnVar> columnVarMap = new Dictionary <string, ColumnVar>();

            foreach (ColumnMD c in tableMetadata.Columns)
            {
                ColumnVar v = command.CreateColumnVar(this, c);
                columnVarMap[c.Name] = v;
                if (!c.IsNullable)
                {
                    m_nonnullableColumns.Set(v);
                }
            }

            foreach (ColumnMD c in tableMetadata.Keys)
            {
                ColumnVar v = columnVarMap[c.Name];
                m_keys.Set(v);
            }

            m_referencedColumns = command.CreateVarVec(m_columns);
        }
示例#2
0
文件: Dump.cs 项目: dox0/DotNet471RS3
        private void DumpVar(Var v)
        {
            Dictionary <string, object> attrs = new Dictionary <string, object>();

            attrs.Add("Var", v.Id);
            ColumnVar cv = v as ColumnVar;

            if (null != cv)
            {
                attrs.Add("Name", cv.ColumnMetadata.Name);
                attrs.Add("Type", TypeHelpers.GetFullName(cv.ColumnMetadata.Type));
            }
            using (new AutoXml(this, v.GetType().Name, attrs)) {
            }
        }
示例#3
0
 /// <summary>
 /// Add a new "equi-join" condition to this edge
 /// </summary>
 /// <param name="joinNode">join node producing this condition</param>
 /// <param name="leftVar">the left-side column</param>
 /// <param name="rightVar">the right-side column</param>
 /// <returns>true, if this condition can be added</returns>
 internal bool AddCondition(AugmentedJoinNode joinNode, ColumnVar leftVar, ColumnVar rightVar)
 {
     if (joinNode != m_joinNode)
     {
         return false;
     }
     m_leftVars.Add(leftVar);
     m_rightVars.Add(rightVar);
     return true;
 }
示例#4
0
 /// <summary>
 /// Creates a new var for a table column
 /// </summary>
 /// <param name="table">The table instance that produces the column</param>
 /// <param name="columnMD">column metadata</param>
 /// <returns>A new ColumnVar instance that references the specified column in the given table</returns>
 internal ColumnVar CreateColumnVar(Table table, ColumnMD columnMD)
 {
     // create a new column var now
     ColumnVar c = new ColumnVar(NewVarId(), table, columnMD);
     table.Columns.Add(c);
     m_vars.Add(c);
     return c;
 }
示例#5
0
        internal static JoinEdge CreateJoinEdge(
            AugmentedTableNode left, AugmentedTableNode right,
            AugmentedJoinNode joinNode,
            ColumnVar leftVar, ColumnVar rightVar)
        {
            var leftVars = new List<ColumnVar>();
            var rightVars = new List<ColumnVar>();
            leftVars.Add(leftVar);
            rightVars.Add(rightVar);

            var joinOpType = joinNode.Node.Op.OpType;
            PlanCompiler.Assert(
                (joinOpType == OpType.LeftOuterJoin || joinOpType == OpType.InnerJoin),
                "Unexpected join type for join edge: " + joinOpType);

            var joinKind = joinOpType == OpType.LeftOuterJoin ? JoinKind.LeftOuter : JoinKind.Inner;

            var joinEdge = new JoinEdge(left, right, joinNode, joinKind, leftVars, rightVars);
            return joinEdge;
        }