--- a/src/SqlHandler.h Sat Oct 26 17:45:37 2019 +0200
+++ b/src/SqlHandler.h Sat Oct 26 19:28:39 2019 +0200
@@ -202,8 +202,8 @@
return relations;
}
- void dumpRelations() {
- std::wregex pattern(configuration.dumpRelations);
+ void copyRelations(const CopyRelations& copy) {
+ std::wregex pattern(copy.pattern);
for (string_t relation : getAllRelations()) {
if (regex_match(relation, pattern)) {
std::wstringstream select;
@@ -211,7 +211,7 @@
writeIdentifier(select, relation);
Statement statement;
- statement.relation = relation;
+ statement.relation = copy.replace ? regex_replace(relation, pattern, copy.replacement) : relation;
statement.sql = select.str();
processStatement(statement);
}
@@ -334,7 +334,7 @@
processSqlInput(configuration.sqlAfterRelational);
// pass-through some relations:
- if (configuration.dumpRelations.size()) dumpRelations();
+ for (const CopyRelations& copy : configuration.copyRelations) copyRelations(copy);
// delete or keep the file:
if (configuration.file.size()) {