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 }; }
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { for(int i=0; i<this.uninstallQueries.Length; i++) { this.Execute(this.uninstallQueries[i], transaction); } }
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>(); }
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()); } }
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 ) ); }
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>(); }
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 ) ) ); }
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), }; }
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 }; }
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), }; }
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.RemoveView(this.viewName); }
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.RemoveStoredProcedure(this.procedure); }
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.RemoveColumn(this.column); }
public abstract XDocument Apply(Transaction transaction);
public abstract IEnumerable<XElement> Apply(Transaction transaction);
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.CreateView(this.viewName, commandRollbackInfo.Element("body").Value); }
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"); }
public abstract void Rollback(Transaction transaction, XDocument rollbackInfo);
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.CreateConstraint(this.constraint); }
public abstract void Rollback(Transaction transaction, XElement commandRollbackInfo);
public override void Rollback(Transaction transaction, XElement commandRollbackInfo) { transaction.RemoveTable(this.table); }
public override void Rollback(Transaction transaction, XDocument rollbackInfo) { throw new NotImplementedException("Persistent patches are not implemented yet"); }