AddWithEncryption options

rickybibirickybibi Posts: 25 Bronze 2
edited November 24, 2005 11:41AM in SQL Toolkit Previous Versions
Is it possible to use the "AddWithEncryption" options with CompareWith and BuildFromDifferences.

Because ,i tried it and it didn't works.

The only way it's working ,it from a snapshots that was created with this options.

If I compare with a database that has not already encrypted, this didn't work.

Thanks

Comments

  • Hello,

    This doesn't sound like the expected behaviour. Is the WITH ENCRYPTION clause missing in the migration SQL for the objects? This could be because BuildFromDifferences does not specify Options.AddWithEncryption in the options enumeration which is the second argument to the buildfromdifferences function.
  • Hello

    exactly , no With encryption in the sql script.

    Here a snap of the code C#:
    RedGate.SQLCompare.Engine.Options Myoptions;
    Myoptions = RedGate.SQLCompare.Engine.Options.Default|
    	RedGate.SQLCompare.Engine.Options.AddWithEncryption|
    	RedGate.SQLCompare.Engine.Options.IncludeDependencies|
    	RedGate.SQLCompare.Engine.Options.IgnoreComments|
    	RedGate.SQLCompare.Engine.Options.ForceColumnOrder|
    	RedGate.SQLCompare.Engine.Options.IgnorePermissions|
    	RedGate.SQLCompare.Engine.Options.IgnoreCollations|
    	RedGate.SQLCompare.Engine.Options.IgnoreQuotedIdentifiersAndAnsiNullSettings;
    
    
    RedGate.SQLCompare.Engine.Database db1=new RedGate.SQLCompare.Engine.Database();
    db1.Status+=new StatusEventHandler(StatusCallback);			
    
    db1.LoadFromDisk(snapShotsFilename);
    
    
    RedGate.SQLCompare.Engine.Database db2=new RedGate.SQLCompare.Engine.Database();
    db2.Status+=new StatusEventHandler(StatusCallback);
    
    
    db2.Register(new RedGate.SQLCompare.Engine.ConnectionProperties(Servername,DbName), Myoptions);
    
    
    RedGate.SQLCompare.Engine.Differences differences=db1.CompareWith(db2, Myoptions);
    
    foreach (RedGate.SQLCompare.Engine.Difference difference in differences)
    {
    	difference.Selected=true;
    	//make sure the difference is selected so it is included in the synchronization
    	if  (difference.DatabaseObjectType == RedGate.SQLCompare.Engine.ObjectType.Table)
    	{
    
    		difference.Selected=true; 
    		
    	} 
    
    }  
    
    RedGate.SQLCompare.Engine.Work work=new RedGate.SQLCompare.Engine.Work();
    
    
    work.BuildFromDifferences(differences, Myoptions , true);
    
    
    foreach (RedGate.SQLCompare.Engine.Message message in work.Messages)
    {
    	//Console.WriteLine(message.Text);
    	UpdateStatus(message.Text,0,0,"");
    }
    
    //Console.WriteLine("Warnings:");
    
    foreach (RedGate.SQLCompare.Engine.Message message in work.Warnings)
    {
    	//Console.WriteLine(message.Text);
    	UpdateStatus(message.Text,0,0,"");
    }
    
    //print out the SQL used to synchronize
    ExecutionBlock block=work.ExecutionBlock ;
    
    //Console.WriteLine("SQL to synchronize:");
    //UpdateStatus("Saved SQL Script",0);
    
    //Console.WriteLine(block.ToString());
    //UpdateStatus(block.ToString(),0);
    
    
    utils.ExecuteBlock(block, Servername, DbName);
    
    
    //dispose of the objects
    block.Dispose();
    db1.Dispose();
    db2.Dispose();
    

    All objects in the snapshot are NOT encrypted.
    The option seems like to be ignore in buildfrom difference !

    Thanks


    Thanks
  • Hi,

    Sorry for the confusion. This does appear to be the way the SQLCompare.Engine works: it adds WITH ENCRYPTION to all objects that support encryption by adding WITH ENCRYPTION to the data definition for these objects during registration.

    Therefore, you'd need to register the database with the Add With Encryption turned on for it to work properly. If your snapshot was created with the option off, any objects that you migrate will not be created with encryption on the destination database.
  • Oh ,

    Ok

    Thanks
Sign In or Register to comment.