public void ExportTable(Table table, string path, ConnectionString connectionString) { try { if (File.Exists(path)) { File.Delete(path); } StringBuilder sb = new StringBuilder(); sb.Append("SET NOCOUNT ON\r\n\r\n"); table = _dataGenerationService.GenerateDataForTable(connectionString, table, true); string sql = _sqlGenerationService.GenerateUpdateSqlForTable(table, true); sb.Append(sql); sb.Append("SET NOCOUNT OFF\r\n\r\n"); using (StreamWriter writer = new StreamWriter(path)) { writer.Write(sb.ToString()); } } catch (Exception ex) { Logging.LogException(ex); throw; } }
public void Process() { if (_table.AreAnyGeneratorsActive) { Table table = _dataGenerationService.GenerateDataForTable(_connectionString, _table, true); string sql = _sqlGenerationService.GenerateUpdateSqlForTable(table, false); if (String.IsNullOrEmpty(sql) == false) { _eventAggregator.SendMessage <StatusUpdateEvent>(new StatusUpdateEvent(string.Format("Processing SQL query for table: {0}", table.FullTableName))); try { _rowsProcessed = _databaseInteractionService.ProcessSql(_connectionString, sql); } catch (Exception ex) { _errorString = ex.ToString(); } } } }
public ObfuscationResult ObfuscateTable(ConnectionString connectionString, Table table) { ObfuscationResult result = new ObfuscationResult(); result.DatabaseName = connectionString.DatabaseName; result.StartTimeStamp = DateTime.Now; if (table.AreAnyGeneratorsActive) { Table newTable = _dataGenerationService.GenerateDataForTable(connectionString, table, true); string sql = _sqlGenerationService.GenerateUpdateSqlForTable(newTable, false); if (String.IsNullOrEmpty(sql) == false) { _eventAggregator.SendMessage <StatusUpdateEvent>(new StatusUpdateEvent(string.Format("Processing SQL query for table: {0}", table.FullTableName))); int rowsProcessed = _databaseInteractionService.ProcessSql(connectionString, sql); result.TablesProcessed.Add(table.FullTableName, rowsProcessed); } } result.FinsihedTimeStamp = DateTime.Now; return(result); }