Beispiel #1
0
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure creation is not implemented yet");
            }

            var options = transaction.GetColumnOptions(column);
            /*Console.WriteLine();
            Console.Write(options.type);
            if(options.defaultValue != null)
            {
                Console.Write(" DEFAULT " + options.defaultValue);
            }
            if(options.isNotNull)
            {
                Console.Write(" NOT NULL");
            }
            Console.WriteLine();
            Console.WriteLine("'" + options.defaultValue + "'");*/
            transaction.RemoveColumn(column);
            return new[]
                   {
                   	new XElement("type", options.type),
                   	options.defaultValue != null ? new XElement("defaultValue", options.defaultValue) : null,
                   	options.isNotNull ? new XElement("isNotNull") : null
                   };
        }
Beispiel #2
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     for(int i=0; i<this.uninstallQueries.Length; i++)
     {
         this.Execute(this.uninstallQueries[i], transaction);
     }
 }
Beispiel #3
0
 public override IEnumerable<XElement> Apply(Transaction transaction)
 {
     for(int i=0; i<this.installQueries.Length; i++)
     {
         this.Execute(this.installQueries[i], transaction);
     }
     return Enumerable.Empty<XElement>();
 }
Beispiel #4
0
        public override void Rollback(Transaction transaction, XDocument rollbackInfo)
        {
            this.CheckDbDriver();

            for(int i=this.commands.Length-1; i>=0; i--)
            {
                commands[i].Rollback(transaction, (from commandRollbackInfo in rollbackInfo.Root.Elements("command") where commandRollbackInfo.Attribute("num").Value == i.ToString() select commandRollbackInfo).Single());
            }
        }
Beispiel #5
0
 protected void Execute(string sql, Transaction transaction)
 {
     try
     {
         transaction.ExecuteNonQuery(sql);
     } catch(Exception e)
     {
         throw new ApplicationException("Error while executing query <" + sql + ">", e);
     }
 }
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.ReplaceStoredProcedureBody(
         this.procedure,
         new StoredProcedureBody(
             commandRollbackInfo.Element("oldDeclarations").Value,
             commandRollbackInfo.Element("oldBody").Value
         )
     );
 }
Beispiel #7
0
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure creation is not implemented yet");
            }

            transaction.CreateView(this.viewName, this.body);
            return Enumerable.Empty<XElement>();
        }
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure creation is not implemented yet");
            }

            transaction.RemoveConstraint(this.constraint);
            return Enumerable.Empty<XElement>();
        }
Beispiel #9
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.ModifyColumn(
         new ColumnDescription(
             this.column,
             new ColumnOptions(
                 commandRollbackInfo.Element("type").Value,
                 commandRollbackInfo.Element("defaultValue") != null ? commandRollbackInfo.Element("defaultValue").Value : null,
                 commandRollbackInfo.Element("isNotNull") != null
             )
         )
     );
 }
Beispiel #10
0
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure creation is not implemented yet");
            }

            string body = transaction.GetViewBody(this.viewName);

            transaction.RemoveView(this.viewName);
            return new XElement[] {
                         new XElement("body", body),
                        };
        }
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure removal is not implemented yet");
            }

            StoredProcedureBody body = transaction.GetStoredProcedureBody(this.procedure);
            transaction.RemoveStoredProcedure(this.procedure);
            return new[]
                   {
                   	new XElement("declarations", body.declarations),
                   	new XElement("body", body.body),
                   };
        }
Beispiel #12
0
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure creation is not implemented yet");
            }

            var oldOptions = transaction.GetColumnOptions(column);
            transaction.ModifyColumn(this.description);
            return new[]
                   {
                   	new XElement("type", oldOptions.type),
                   	oldOptions.defaultValue != null ? new XElement("defaultValue", oldOptions.defaultValue) : null,
                   	oldOptions.isNotNull ? new XElement("isNotNull") : null
                   };
        }
Beispiel #13
0
        public override XDocument Apply(Transaction transaction)
        {
            this.CheckDbDriver();

            List<XElement> rollbackInfos = new List<XElement>();
            for(int i=0; i<this.commands.Length; i++)
            {
                IEnumerable<XElement> commandRollbackInfoContent;
                if (commands[i] is AbstractPersistentCommand)
                {
                    commandRollbackInfoContent = ((AbstractPersistentCommand)commands[i]).Apply(transaction, true);
                } else
                {
                    commandRollbackInfoContent = commands[i].Apply(transaction);
                }
                rollbackInfos.Add(new XElement("command", new XAttribute("num", i), commandRollbackInfoContent));
            }
            return new XDocument(new XElement("rollbackInfo", rollbackInfos.ToArray()));
        }
        public override IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity)
        {
            if(!forceIntegrity)
            {
                throw new NotImplementedException("Safe stored procedure change is not implemented yet");
            }

            StoredProcedureBody oldBody = transaction.GetStoredProcedureBody(this.procedure);
            /*Console.WriteLine();
            Console.WriteLine("===OLD DECLARATIONS===");
            Console.WriteLine(oldBody.declarations);
            Console.WriteLine("===OLD BODY===");
            Console.WriteLine(oldBody.body);
            Console.WriteLine("===END===");*/
            transaction.ReplaceStoredProcedureBody(this.procedure, this.body);
            return new[]
                   {
                   	new XElement("oldDeclarations", oldBody.declarations),
                   	new XElement("oldBody", oldBody.body),
                   };
        }
Beispiel #15
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.RemoveView(this.viewName);
 }
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.RemoveStoredProcedure(this.procedure);
 }
Beispiel #17
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.RemoveColumn(this.column);
 }
Beispiel #18
0
 public abstract XDocument Apply(Transaction transaction);
Beispiel #19
0
 public abstract IEnumerable<XElement> Apply(Transaction transaction);
Beispiel #20
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.CreateView(this.viewName, commandRollbackInfo.Element("body").Value);
 }
Beispiel #21
0
 public override XDocument Apply(Transaction transaction)
 {
     throw new NotImplementedException("Persistent patches are not implemented yet");
 }
 public abstract IEnumerable<XElement> Apply(Transaction transaction, bool forceIntegrity);
 public override sealed IEnumerable<XElement> Apply(Transaction transaction)
 {
     throw new ApplicationException("Cannot apply persistent command");
 }
Beispiel #24
0
 public abstract void Rollback(Transaction transaction, XDocument rollbackInfo);
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.CreateConstraint(this.constraint);
 }
Beispiel #26
0
 public abstract void Rollback(Transaction transaction, XElement commandRollbackInfo);
Beispiel #27
0
 public override void Rollback(Transaction transaction, XElement commandRollbackInfo)
 {
     transaction.RemoveTable(this.table);
 }
Beispiel #28
0
 public override void Rollback(Transaction transaction, XDocument rollbackInfo)
 {
     throw new NotImplementedException("Persistent patches are not implemented yet");
 }