| 371 | |
| 372 | |
| 373 | void OMSFileStore::storeProcessingSoftwares_(const IdentificationData& id_data) |
| 374 | { |
| 375 | if (id_data.getProcessingSoftwares().empty()) return; |
| 376 | |
| 377 | createTable_("ID_ProcessingSoftware", |
| 378 | "id INTEGER PRIMARY KEY NOT NULL, " \ |
| 379 | "name TEXT NOT NULL, " \ |
| 380 | "version TEXT, " \ |
| 381 | "UNIQUE (name, version)"); |
| 382 | |
| 383 | SQLite::Statement query(*db_, "INSERT INTO ID_ProcessingSoftware VALUES (" \ |
| 384 | ":id, " \ |
| 385 | ":name, " \ |
| 386 | ":version)"); |
| 387 | bool any_scores = false; // does any software have assigned scores stored? |
| 388 | Key id = 1; |
| 389 | for (const ID::ProcessingSoftware& software : id_data.getProcessingSoftwares()) |
| 390 | { |
| 391 | if (!software.assigned_scores.empty()) any_scores = true; |
| 392 | query.bind(":id", id); |
| 393 | query.bind(":name", software.getName()); |
| 394 | query.bind(":version", software.getVersion()); |
| 395 | execWithExceptionAndReset(query, 1, __LINE__, OPENMS_PRETTY_FUNCTION, "error inserting data"); |
| 396 | processing_software_keys_[&software] = id; |
| 397 | ++id; |
| 398 | } |
| 399 | if (any_scores) |
| 400 | { |
| 401 | createTable_( |
| 402 | "ID_ProcessingSoftware_AssignedScore", |
| 403 | "software_id INTEGER NOT NULL, " \ |
| 404 | "score_type_id INTEGER NOT NULL, " \ |
| 405 | "score_type_order INTEGER NOT NULL, " \ |
| 406 | "UNIQUE (software_id, score_type_id), " \ |
| 407 | "UNIQUE (software_id, score_type_order), " \ |
| 408 | "FOREIGN KEY (software_id) REFERENCES ID_ProcessingSoftware (id), " \ |
| 409 | "FOREIGN KEY (score_type_id) REFERENCES ID_ScoreType (id)"); |
| 410 | |
| 411 | SQLite::Statement query2(*db_, |
| 412 | "INSERT INTO ID_ProcessingSoftware_AssignedScore VALUES (" \ |
| 413 | ":software_id, " \ |
| 414 | ":score_type_id, " \ |
| 415 | ":score_type_order)"); |
| 416 | for (const ID::ProcessingSoftware& software : id_data.getProcessingSoftwares()) |
| 417 | { |
| 418 | query2.bind(":software_id", processing_software_keys_[&software]); |
| 419 | Size counter = 0; |
| 420 | for (ID::ScoreTypeRef score_type_ref : software.assigned_scores) |
| 421 | { |
| 422 | query2.bind(":score_type_id", score_type_keys_[&(*score_type_ref)]); |
| 423 | query2.bind(":score_type_order", int(++counter)); |
| 424 | execWithExceptionAndReset(query2, 1, __LINE__, OPENMS_PRETTY_FUNCTION, "error inserting data"); |
| 425 | } |
| 426 | } |
| 427 | } |
| 428 | } |
| 429 | |
| 430 |
nothing calls this directly
no test coverage detected