Ejemplo n.º 1
0
        private void DeleteMetaRow(TableBackup tableBackup)
        {
            if (!BaseEntitiesExist())
            {
                throw new SqlDatabaseException("Base entities don't exist");
            }

            SqlTable metaDataTable = GetMetadataTable();

            using (SqlConnection databaseConnection = new SqlConnection(GetConnectionString()))
                using (SqlCommand sqlCmd = new SqlCommand())
                {
                    sqlCmd.Connection  = databaseConnection;
                    sqlCmd.CommandText = string.Format(@"
                    delete from {0}
                    where base_object_id = @base_object_id
                    and backup_object_id = @backup_object_id;", metaDataTable.FullyQuotedName);

                    sqlCmd.Parameters.Add(new SqlParameter("@base_object_id", SqlDbType.Int)
                    {
                        Value = tableBackup.SourceTable.ObjectId
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@backup_object_id", SqlDbType.Int)
                    {
                        Value = tableBackup.BackupTable.ObjectId
                    });

                    databaseConnection.Open();
                    sqlCmd.ExecuteNonQuery();
                }
        }
Ejemplo n.º 2
0
        public void RemoveBackup(TableBackup tableBackup)
        {
            if (tableBackup == null)
            {
                throw new ArgumentNullException("tableBackup");
            }

            RemoveTable(tableBackup.BackupTable);

            // do a sanity check to make sure the backup table
            // was actually removed, and if not then we should
            // throw an exception
            //
            if (GetTable(tableBackup.BackupTable.ObjectId) != null)
            {
                throw new SqlDatabaseException("Expected to have deleted the backup table, but it still exists");
            }

            // otherwise, if the table is gone then remove the row
            // from the meta data table
            //
            DeleteMetaRow(tableBackup);
        }
Ejemplo n.º 3
0
 public SqlTable RestoreTable(TableBackup tableBackup, RestoreRetention restoreRetention)
 {
     SqlTable schemaTransferredTable = MoveTableSchema(tableBackup.)
 }
Ejemplo n.º 4
0
 public SqlTable RestoreTable(TableBackup tableBackup)
 {
     return(RestoreTable(tableBackup, RestoreRetention.KeepReplacedTable));
 }