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(); } }
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); }
public SqlTable RestoreTable(TableBackup tableBackup, RestoreRetention restoreRetention) { SqlTable schemaTransferredTable = MoveTableSchema(tableBackup.) }
public SqlTable RestoreTable(TableBackup tableBackup) { return(RestoreTable(tableBackup, RestoreRetention.KeepReplacedTable)); }