Options

Write Compare Differences to Scripts Folder

tater9104tater9104 Posts: 2
Hey,

I am working on a small executable that allows me to check for a difference between a target live database and a script folder and write any differences to that script folder.

For the most part, I see how to do this, but I am unsure how to write the difference back out to the scripts folder.

Here is my code (note my last comment in this code block):


using (Database LiveDB = new Database(), ScriptDB = new Database())
{

	LiveDB.Register(new ConnectionProperties(userArgs["s"], userArgs["d"], userArgs["u"], userArgs["p"]), Options.Default);

	ReadFromScriptDatabaseInformation ScriptDBInfo = new ReadFromScriptDatabaseInformation();

	ScriptDB.Register(userArgs["t"], ScriptDBInfo, Options.Default);

	Differences LiveVSScripts = LiveDB.CompareWith(ScriptDB, Options.Default ^ Options.IncludeDependencies);

	foreach (Difference tempDiff in LiveVSScripts)
	{
		tempDiff.Selected = true;
	}

	Work work = new Work();

	work.BuildFromDifferences(LiveVSScripts, Options.Default ^ Options.IncludeDependencies, true);

	//Write out any warnings / messages...
	Console.WriteLine("Messages:");
	foreach (Message message in work.Messages)
	{
		Console.WriteLine(message.Text);
	}

	Console.WriteLine("Warnings:");
	foreach (Message message in work.Warnings)
	{
		Console.WriteLine(message.Text);
	}
	
	using (ExecutionBlock block = work.ExecutionBlock)
	{

		Console.WriteLine("SQL to synchronize:");
		Console.WriteLine(block.GetString());

		BlockExecutor executor = new BlockExecutor();
		
		//What do I do here to write the differnces back out to the scripts file?

		
	}
}

Comments

Sign In or Register to comment.