Fix opslaan van connectie

This commit is contained in:
eelke 2025-02-25 18:26:05 +01:00
parent 3c943b1503
commit fdf049a2a3
2 changed files with 23 additions and 0 deletions

View file

@ -185,6 +185,25 @@ INSERT INTO connection_parameter (connection_uuid, pname, pvalue)
stmt.Bind(4, b64.data(), b64.length());
}
stmt.Step();
stmt = db.Prepare(
"DELETE FROM connection_parameter WHERE connection_uuid=?1");
stmt.Bind(1, cc.uuid().toString());
stmt.Step();
stmt = db.Prepare(
R"__(INSERT INTO connection_parameter (connection_uuid, pname, pvalue)
VALUES(?1, ?2, ?3))__");
const std::unordered_map<QString, QString>& params = cc.getParameters();
for (auto && p : params)
{
stmt.Reset();
stmt.Bind(1, cc.uuid().toString());
stmt.Bind(2, p.first);
stmt.Bind(3, p.second);
stmt.Step();
}
tx.Commit();
}
} // end of unnamed namespace

View file

@ -135,6 +135,10 @@ public:
void setParameter(const QString &name, const QString &value);
QString getParameter(const QString &name) const;
const std::unordered_map<QString, QString>& getParameters() const
{
return m_parameters;
}
private:
QUuid m_uuid;
QString m_name;