| 190 | } |
| 191 | |
| 192 | void Storage::AddProject(AuthProfile profile) |
| 193 | { |
| 194 | QJsonObject json; |
| 195 | json["host"] = profile.GetHost(); |
| 196 | json["port"] = profile.GetPort(); |
| 197 | json["endpoint"] = profile.GetEndpoint(); |
| 198 | json["username"] = profile.GetUsername(); |
| 199 | json["password"] = profile.GetPassword(); |
| 200 | json["projectDir"] = profile.GetProjectDir(); |
| 201 | json["subscriptions"] = QJsonArray::fromStringList(profile.GetSubscriptions()); |
| 202 | json["consoleMultiuser"] = profile.GetConsoleMultiuser(); |
| 203 | QString data = QJsonDocument(json).toJson(QJsonDocument::Compact); |
| 204 | |
| 205 | QSqlQuery query(QSqlDatabase::database(DB_CONNECTION_NAME)); |
| 206 | query.prepare( "INSERT INTO Projects (project, data) VALUES (:Project, :Data);"); |
| 207 | query.bindValue(":Project", profile.GetProject()); |
| 208 | query.bindValue(":Data", data); |
| 209 | if (!query.exec()) |
| 210 | LogError("The project has not been added to the database: %s\n", query.lastError().text().toStdString().c_str()); |
| 211 | } |
| 212 | |
| 213 | void Storage::UpdateProject(AuthProfile profile) |
| 214 | { |
no test coverage detected