Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

campaign management: update sqlite database after another run #4038

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading