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")); }
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); }
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; }