public void CanRenameTable()
        {
            var expression = new RenameTableExpression();
            expression.SchemaName = "dbo";
            expression.OldName = "Table1";
            expression.NewName = "Table2";

            var sql = generator.Generate( expression );
            sql.ShouldBe( "sp_rename '[dbo].[Table1]', 'Table2'" );
        }
 public IRenameTableToOrInSchemaSyntax Table(string oldName)
 {
     var expression = new RenameTableExpression { OldName = oldName };
     _context.Expressions.Add(expression);
     return new RenameTableExpressionBuilder(expression);
 }
 public override string Generate(RenameTableExpression expression)
 {
     truncator.Truncate(expression);
     return compatabilityMode.HandleCompatabilty("Rename table is not supported");
 }
 public override string Generate(RenameTableExpression expression)
 {
     return String.Format(RenameTable, Quoter.QuoteTableName(expression.OldName), Quoter.QuoteTableName(expression.NewName));
 }
 public override string Generate(RenameTableExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1} RENAME TO {2}", Quoter.QuoteSchemaName(expression.SchemaName), Quoter.QuoteTableName(expression.OldName), Quoter.QuoteTableName(expression.NewName));
 }
 public virtual void Process(RenameTableExpression expression)
 {
     Process(Generator.Generate(expression));
 }
 public void Truncate(RenameTableExpression expression)
 {
     expression.OldName = Truncate(expression.OldName);
     expression.NewName = Truncate(expression.NewName);
 }
 public abstract string Generate(RenameTableExpression expression);
 public void ErrorIsReturnedWhenNewNameIsEmptyString()
 {
     var expression = new RenameTableExpression { NewName = String.Empty };
     var errors = ValidationHelper.CollectErrors(expression);
     errors.ShouldContain(ErrorMessages.NewTableNameCannotBeNullOrEmpty);
 }
 public void ErrorIsNotReturnedWhenOldNameIsNotNullEmptyString()
 {
     var expression = new RenameTableExpression { OldName = "Bacon" };
     var errors = ValidationHelper.CollectErrors(expression);
     errors.ShouldNotContain(ErrorMessages.OldTableNameCannotBeNullOrEmpty);
 }
 public void ToStringIsDescriptive()
 {
     var expression = new RenameTableExpression { OldName = "Bacon", NewName = "ChunkyBacon" };
     expression.ToString().ShouldBe("RenameTable Bacon ChunkyBacon");
 }
 public override string Generate(RenameTableExpression expression)
 {
     return String.Format("sp_rename '{0}[{1}]', '{2}'", FormatSchema( expression.SchemaName ), expression.OldName, FormatSqlEscape(expression.NewName));
 }
 public override string Generate(RenameTableExpression expression)
 {
     return String.Format("sp_rename {0}, {1}", Quoter.QuoteValue(expression.OldName), Quoter.QuoteValue(expression.NewName));
 }
 public override string Generate(RenameTableExpression expression)
 {
     return FormatExpression("sp_rename [{0}], [{1}]", expression.OldName, expression.NewName);
 }
 public override string Generate(RenameTableExpression expression)
 {
     return String.Format("RENAME TABLE `{0}` TO `{1}`", expression.OldName, expression.NewName);
 }
        public void CanRenameTable()
        {
            var expression = new RenameTableExpression();
            expression.OldName = "Table1";
            expression.NewName = "Table2";

            var sql = generator.Generate(expression);
            sql.ShouldBe("sp_rename [Table1], [Table2]");
        }
 public void CanRenameTable()
 {
     RenameTableExpression expression = new RenameTableExpression { OldName = oldTable, NewName = newTable };
     string sql = generator.Generate(expression);
     sql.ShouldBe(string.Format("ALTER TABLE [{0}] RENAME TO [{1}]", oldTable, newTable));
 }
 public void ErrorIsReturnedWhenOldNameIsNull()
 {
     var expression = new RenameTableExpression { OldName = null };
     var errors = ValidationHelper.CollectErrors(expression);
     errors.ShouldContain(ErrorMessages.OldTableNameCannotBeNullOrEmpty);
 }
        public void CanRenameTable()
        {
            var expression = new RenameTableExpression();
            expression.OldName = "Table1";
            expression.NewName = "Table2";

            string sql = generator.Generate(expression);
            sql.ShouldBe("ALTER TABLE \"public\".\"Table1\" RENAME TO \"Table2\"");
        }
 public void ReverseReturnsRenameTableExpression()
 {
     var expression = new RenameTableExpression { OldName = "Bacon", NewName = "ChunkyBacon" };
     var reverse = expression.Reverse();
     reverse.ShouldBeOfType<RenameTableExpression>();
 }
 public static RenameTableExpression GetRenameTableExpression()
 {
     var expression = new RenameTableExpression();
     expression.OldName = TestTableName1;
     expression.NewName = TestTableName2;
     return expression;
 }
 public void ReverseSetsOldNameAndNewNameOnGeneratedExpression()
 {
     var expression = new RenameTableExpression { OldName = "Bacon", NewName = "ChunkyBacon" };
     var reverse = expression.Reverse() as RenameTableExpression;
     reverse.OldName.ShouldBe("ChunkyBacon");
     reverse.NewName.ShouldBe("Bacon");
 }
 public override string Generate(RenameTableExpression expression)
 {
     return FormatExpression("sp_rename '{0}[{1}]', '[{2}]'", FormatSchema( expression.SchemaName ), expression.OldName, expression.NewName);
 }
        public void CanRenameTable()
        {
            var expression = new RenameTableExpression();
            expression.OldName = "Table1";
            expression.NewName = "Table2";

            string sql = generator.Generate(expression);
            sql.ShouldBe(String.Empty);
        }
 public override string Generate(RenameTableExpression expression)
 {
     return String.Format("ALTER TABLE {0} RENAME TO {1}", expression.OldName, expression.NewName);
 }
 public override string Generate(RenameTableExpression expression)
 {
     return FormatExpression("RENAME TABLE {0} TO {1}", expression.OldName, expression.NewName);
 }
 public override string Generate(RenameTableExpression expression)
 {
     return string.Format("sp_rename '{0}.{1}", Quoter.QuoteSchemaName(expression.SchemaName), base.Generate(expression));
 }
Exemple #28
0
 public override string Generate(RenameTableExpression expression)
 {
     return compatabilityMode.HandleCompatabilty("Renaming of tables is not supporteed for MySql");
 }
        public void CanRenameTable()
        {
            var expression = new RenameTableExpression();
            expression.OldName = "Table1";
            expression.NewName = "Table2";

            var sql = generator.Generate(expression);
            sql.ShouldBe("RENAME TABLE `Table1` TO `Table2`");
        }
 public override string Generate(RenameTableExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1} RENAME TO {2}", FormatSchema(expression.SchemaName), FormatIdentifier(expression.OldName), FormatIdentifier(expression.NewName));
 }