Skip to content

Commit 11e118a

Browse files
authored
Merge pull request #119 from tpflueger/master
Enable excluding rows for certain tables
2 parents 66e76be + 5c899ec commit 11e118a

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

source code/MySqlBackup(MySqlConnector)/InfoObjects/ExportInformations.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ public class ExportInformations
1919
Dictionary<string, string> _customTable = new Dictionary<string, string>();
2020

2121
List<string> _lstExcludeTables = null;
22-
22+
List<string> _lstExcludeRowsForTables = null;
23+
2324
/// <summary>
2425
/// Gets or Sets the tables (black list) that will be excluded for export. The rows of the these tables will not be exported too.
2526
/// </summary>
@@ -37,6 +38,23 @@ public List<string> ExcludeTables
3738
}
3839
}
3940

41+
/// <summary>
42+
/// Gets or Sets the tables (black list) that will be excluded for row export.
43+
/// </summary>
44+
public List<string> ExcludeRowsForTables
45+
{
46+
get
47+
{
48+
if (_lstExcludeRowsForTables == null)
49+
_lstExcludeRowsForTables = new List<string>();
50+
return _lstExcludeRowsForTables;
51+
}
52+
set
53+
{
54+
_lstExcludeRowsForTables = value;
55+
}
56+
}
57+
4058
/// <summary>
4159
/// Gets the list of document headers.
4260
/// </summary>

source code/MySqlBackup(MySqlConnector)/MySqlBackup.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ void Export_TableRows()
381381
if (ExportInfo.ExportTableStructure)
382382
Export_TableStructure(tableName);
383383

384-
if (ExportInfo.ExportRows)
384+
var excludeRows = Export_ThisRowForTableIsExcluded(tableName);
385+
if (ExportInfo.ExportRows && !excludeRows)
385386
Export_Rows(tableName, selectSQL);
386387
}
387388
}
@@ -400,6 +401,19 @@ bool Export_ThisTableIsExcluded(string tableName)
400401
return false;
401402
}
402403

404+
bool Export_ThisRowForTableIsExcluded(string tableName)
405+
{
406+
var tableNameLower = tableName.ToLower();
407+
408+
foreach (var blacklistedTable in ExportInfo.ExcludeRowsForTables)
409+
{
410+
if (blacklistedTable.ToLower() == tableNameLower)
411+
return true;
412+
}
413+
414+
return false;
415+
}
416+
403417
void Export_TableStructure(string tableName)
404418
{
405419
if (stopProcess)

0 commit comments

Comments
 (0)