Exemple #1
0
 public BasicJoinTableNode(ITableNode tableNode1, ITableNode tableNode2, JoinType joinType, IOnNode onNode)
 {
     TableNode1 = tableNode1;
     TableNode2 = tableNode2;
     JoinType   = joinType;
     OnNode     = onNode;
 }
        public static QsiTableNode VisitTableNode(ITableNode node)
        {
            switch (node.Unwrap())
            {
            case NamedTableNode namedTableNode:
                return(VisitNamedTableNode(namedTableNode));

            case BindTableNode bindTableNode:
                return(VisitBindTableNode(bindTableNode));

            case JoinTableNode joinTableNode:
                return(VisitJoinTableNode(joinTableNode));

            case DerivedTableNode derivedTableNode:
                return(VisitDerivedTableNode(derivedTableNode));

            default:
                throw TreeHelper.NotSupportedTree(node);
            }
        }
        private void IncludeTemplates(ITableNode tableNode)
        {
            //
            // If child nodes contain IIncludeTemplateNodes, process them first
            while(tableNode.ChildNodes.Any(n => n is IIncludeTemplateNode))
            {
                var includeTemplateNode = (IIncludeTemplateNode)tableNode.ChildNodes.First(n => n is IIncludeTemplateNode);
                var includeTemplateNodeIndex = tableNode.ChildNodes.IndexOf(includeTemplateNode);
                
                //
                // Insert cloned nodes immediately after includeTemplateNode. We're processing
                // these nodes in reverse order to simplify things
                foreach(var templateNode in GetTemplateNodes(tableNode, includeTemplateNode.Name).Reverse())
                    tableNode.ChildNodes.Insert(includeTemplateNodeIndex, templateNode);

                //
                // And then delete the includeTemplateNode
                tableNode.ChildNodes.Remove(includeTemplateNode);
            } // if
        }
Exemple #4
0
 public BasicFromNode(ITableNode table)
 {
     Table = table;
 }
        private IEnumerable<string> GetConstraintsDefinitions(ITableNode table)
        {
            //
            // First, collect all PKs
            if(!table.ChildNodes.OfType<IAddColumnNode>().Where(acn => acn.PrimaryKey ?? false).Any()) yield break;

            yield return
                string.Format("\tprimary key ({0})",
                    Join(", ", table.ChildNodes.OfType<IAddColumnNode>().Where(acn => acn.PrimaryKey ?? false).Select(c => c.Name)));
        }
Exemple #6
0
 public MainFormEventArgs(ITableNode node)
 {
     this.Node = node;
 }