Exemplo n.º 1
0
        public void ExecuteCreateTableCommand()
        {
            CreateTableCommand cmd = new CreateTableCommand("Customers");
            cmd.AddColumn(new Column("Name"));
            cmd.AddColumn(new Column("Address"));

            cmd.Execute(this.database);

            Table table = this.database.GetTable("Customers");

            Assert.IsNotNull(table);
            Assert.AreEqual(2, table.ColumnCount);
            Assert.IsNotNull(table.GetColumn("Name"));
            Assert.IsNotNull(table.GetColumn("Address"));
        }
Exemplo n.º 2
0
        private ICommand ParseCreateTable()
        {
            string name = this.ParseName();

            CreateTableCommand cmd = new CreateTableCommand(name);

            this.Parse("(", TokenType.Separator);

            while (!this.TryParse(")", TokenType.Separator))
            {
                cmd.AddColumn(this.ParseColumnDefinition());

                if (this.TryParse(")", TokenType.Separator))
                {
                    break;
                }

                this.Parse(",", TokenType.Separator);
            }

            return(cmd);
        }
Exemplo n.º 3
0
        private ICommand ParseCreateTable()
        {
            string name = this.ParseName();

            CreateTableCommand cmd = new CreateTableCommand(name);

            this.Parse("(", TokenType.Separator);

            while (!this.TryParse(")", TokenType.Separator))
            {
                cmd.AddColumn(this.ParseColumnDefinition());

                if (this.TryParse(")", TokenType.Separator))
                    break;

                this.Parse(",", TokenType.Separator);
            }

            return cmd;
        }