| Author |
Message |
tater9104
Joined: 12 Feb 2009 Posts: 1
|
Posted: Thu Feb 12, 2009 8:37 pm Post subject: Write Compare Differences to Scripts Folder |
|
|
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):
| Code: |
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?
}
} |
|
|
| Back to top |
|
 |
Brian Donahue
Joined: 23 Aug 2004 Posts: 6341 Location: Red Gate Software
|
Posted: Mon Feb 16, 2009 7:46 pm Post subject: |
|
|
Hi,
Thanks for your post. I believe you can find an example of synchronizing to a script folder on the Comparison SDK wiki:
http://labs.red-gate.com/index.php/Synchronizing_Schema_-_Live_Database%2C_Scripts_folder
If this isn't clear enough, feel free to let me know. _________________ Brian Donahue
Technical Support
Red Gate Software Ltd.
44 (0)870 160 0037 ext 8521
US and CAN 1-866-RED GATE ext 8521 |
|
| Back to top |
|
 |
|
|
All times are GMT + 1 Hour
|
| Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group