Skip to content

Commit

Permalink
Merge pull request #4038 from dmitry-ganyushin/campaign-update
Browse files Browse the repository at this point in the history
campaign management: update sqlite database after another run
  • Loading branch information
pnorbert authored Feb 20, 2024
2 parents 2d3198a + ed92133 commit 27e5be1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/adios2/engine/campaign/CampaignManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name
{
sqlite3 *db;
int rc;
char *zErrMsg = 0;
char *zErrMsg = nullptr;
std::string sqlcmd;
std::string db_name = name + ".db";
rc = sqlite3_open(db_name.c_str(), &db);
Expand All @@ -43,7 +43,7 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name
"SQL error on writing records:");
sqlite3_free(zErrMsg);
}
sqlcmd = "CREATE TABLE bpfiles (name);";
sqlcmd = "CREATE TABLE if not exists bpfiles (name);";
rc = sqlite3_exec(db, sqlcmd.c_str(), 0, 0, &zErrMsg);
if (rc != SQLITE_OK)
{
Expand All @@ -57,8 +57,8 @@ int CMapToSqlite(const CampaignRecordMap &cmap, const int rank, std::string name
size_t rowid = 1000;
for (auto &r : cmap)
{
sqlcmd = "INSERT INTO bpfiles (rowid, name)\n";
sqlcmd += "VALUES(" + std::to_string(rowid) + "," + "'" + r.first + "'" + ");";
sqlcmd = "INSERT INTO bpfiles (name)\n";
sqlcmd += "VALUES('" + r.first + "');";
rowid++;
rc = sqlite3_exec(db, sqlcmd.c_str(), 0, 0, &zErrMsg);
if (rc != SQLITE_OK)
Expand Down

0 comments on commit 27e5be1

Please sign in to comment.