comparison OrthancServer/SQLiteDatabaseWrapper.cpp @ 3033:5da6d1063d8f db-changes

effectively replacing LookupResource by DatabaseLookup in searches
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Dec 2018 13:58:28 +0100
parents 18a2d196414b
children 8fd203510d8b
comparison
equal deleted inserted replaced
3032:19ebb606910d 3033:5da6d1063d8f
1501 std::vector<std::string>& instancesId, 1501 std::vector<std::string>& instancesId,
1502 const std::vector<DatabaseConstraint>& lookup, 1502 const std::vector<DatabaseConstraint>& lookup,
1503 ResourceType queryLevel, 1503 ResourceType queryLevel,
1504 size_t limit) 1504 size_t limit)
1505 { 1505 {
1506 for (size_t i = 0; i < lookup.size(); i++)
1507 {
1508 std::cout << i << ": " << lookup[i].GetTag() << " - " << EnumerationToString(lookup[i].GetLevel());
1509 std::cout << std::endl;
1510 }
1511
1512 assert(ResourceType_Patient < ResourceType_Study && 1506 assert(ResourceType_Patient < ResourceType_Study &&
1513 ResourceType_Study < ResourceType_Series && 1507 ResourceType_Study < ResourceType_Series &&
1514 ResourceType_Series < ResourceType_Instance); 1508 ResourceType_Series < ResourceType_Instance);
1515 1509
1516 ResourceType upperLevel = queryLevel; 1510 ResourceType upperLevel = queryLevel;
1529 { 1523 {
1530 lowerLevel = level; 1524 lowerLevel = level;
1531 } 1525 }
1532 } 1526 }
1533 1527
1534 printf("ICI 2: [%s] -> [%s]\n", EnumerationToString(upperLevel), EnumerationToString(lowerLevel));
1535
1536 { 1528 {
1537 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DROP TABLE IF EXISTS Lookup"); 1529 SQLite::Statement s(db_, SQLITE_FROM_HERE, "DROP TABLE IF EXISTS Lookup");
1538 s.Run(); 1530 s.Run();
1539 } 1531 }
1540 1532
1590 if (limit != 0) 1582 if (limit != 0)
1591 { 1583 {
1592 sql += " LIMIT " + boost::lexical_cast<std::string>(limit); 1584 sql += " LIMIT " + boost::lexical_cast<std::string>(limit);
1593 } 1585 }
1594 1586
1595 printf("[%s]\n", sql.c_str());
1596
1597 SQLite::Statement s(db_, sql); 1587 SQLite::Statement s(db_, sql);
1598 1588
1599 for (size_t i = 0; i < parameters.size(); i++) 1589 for (size_t i = 0; i < parameters.size(); i++)
1600 { 1590 {
1601 printf(" %lu = '%s'\n", i, parameters[i].c_str());
1602 s.BindString(i, parameters[i]); 1591 s.BindString(i, parameters[i]);
1603 } 1592 }
1604 1593
1605 s.Run(); 1594 s.Run();
1606 } 1595 }