public void  TestTreeStringOutputVisitorWithNullTableConstraints()
        {
            var sampleWithoutTableConstraint = new CreateTableNode
            {
                TableName         = "PROJECTS",
                ColumnDefinitions = new[]
                {
                    new ColumnDefNode
                    {
                        ColumnName   = "CLASSID",
                        TypeNameNode = new TypeNameNode {
                            TypeName = "int"
                        },
                        ColumnConstraints = new[] { new DefaultConstraintNode()
                                                    {
                                                        Value = "NULL"
                                                    } }
                    }
                }
            };

            var visitor = new TreeStringOutputVisitor();

            Assert.DoesNotThrow(() => sampleWithoutTableConstraint.Accept(visitor).ToString());
        }
Exemple #2
0
        private IEnumerable <string> CreateNewTableCopyInDataAndCreateIndices(AlterTableCommand command, string tempTable)
        {
            string fullTableName = command.Name;

            //we'll use this to create the insert into later
            string[] originalColumns = CreateTableNode.ColumnDefinitions.Select(i => i.ColumnName).ToArray();

            CreateTableNode = IncorporateAlterationsInCreateNode(command, CreateTableNode);

            var visitor = new TreeStringOutputVisitor();

            yield return(CreateTableNode.Accept(visitor).ToString());

            string[] finalSetOfColumns =
                originalColumns.Where(i => command.TableCommands.OfType <DropColumnCommand>().All(j => j.ColumnName != i))
                .ToArray();

            // this can only be the ones in the ORIGINAL table that we want to copy, i.e. don't copy in deleted columns
            yield return(StatementUtil.InsertInto(fullTableName, finalSetOfColumns, tempTable));

            //let's figure out our final indexes
            IncorporateAlterationsInIndexNodes(CreateIndexNodes, fullTableName, command.TableCommands, finalSetOfColumns);
            var indexNodeVisitor = new TreeStringOutputVisitor();

            foreach (CreateIndexNode indexNode in CreateIndexNodes)
            {
                yield return(indexNode.Accept(indexNodeVisitor).ToString());
            }
        }
Exemple #3
0
        public virtual void Visit(CreateTableNode node)
        {
            foreach (var item in node.Fields)
            {
                item.Accept(this);
            }

            node.Accept(Visitor);
        }
Exemple #4
0
        public void Visit(CreateTableNode node)
        {
            _walker = _walker.NextChild();
            _visitor.SetScope(_walker.Scope);

            node.Accept(_visitor);

            _walker = _walker.Parent();
        }
        public void Visit(CreateTableNode node)
        {
            SetQueryPart(QueryPart.None);
            foreach (var item in node.Fields)
            {
                item.Accept(this);
            }

            node.Accept(_visitor);
        }
 public void Visit(CreateTableNode node)
 {
     node.Accept(_visitor);
 }