Skip to content

Commit

Permalink
dbcopy: added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
franku committed Jan 31, 2020
1 parent de2dee7 commit cc90744
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions core/src/dird/dbconvert/database_export.cc
Expand Up @@ -145,5 +145,6 @@ void DatabaseExport::End()
if (!db_->SqlQuery(sequence_schema_query.c_str())) {
throw std::runtime_error("DatabaseExport: Could not set sequence");
}
std::cout << "Updating sequence for table: " << s.table_name << std::endl;
}
}
8 changes: 4 additions & 4 deletions core/src/dird/dbconvert/database_import.cc
Expand Up @@ -53,7 +53,10 @@ struct ResultHandlerContext {

void DatabaseImport::ExportTo(DatabaseExport& exporter)
{
exporter.Start();

for (const auto& t : table_descriptions_->tables) {
std::cout << "Converting table: " << t.table_name << std::endl;
std::string query{"SELECT "};
for (const auto& col : t.column_descriptions) {
query += col->column_name;
Expand All @@ -68,17 +71,14 @@ void DatabaseImport::ExportTo(DatabaseExport& exporter)
row_data.table_name = t.table_name;
ResultHandlerContext ctx(t.column_descriptions, row_data, exporter);

exporter.Start();

if (!db_->SqlQuery(query.c_str(), ResultHandler, &ctx)) {
std::cout << "Could not import table: " << t.table_name << std::endl;
std::string err{"Could not execute select statement: "};
err += query;
std::cout << query << std::endl;
}

exporter.End();
}
exporter.End();
}

int DatabaseImport::ResultHandler(void* ctx, int fields, char** row)
Expand Down

0 comments on commit cc90744

Please sign in to comment.