comparison OrthancServer/DatabaseWrapper.cpp @ 190:b6cef9d45cc3

getallpublicids
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Nov 2012 11:20:50 +0100
parents ccbc2cf64a0d
children c56dc32266e0
comparison
equal deleted inserted replaced
189:ccbc2cf64a0d 190:b6cef9d45cc3
467 SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT SUM(uncompressedSize) FROM AttachedFiles"); 467 SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT SUM(uncompressedSize) FROM AttachedFiles");
468 s.Run(); 468 s.Run();
469 return static_cast<uint64_t>(s.ColumnInt64(0)); 469 return static_cast<uint64_t>(s.ColumnInt64(0));
470 } 470 }
471 471
472 void DatabaseWrapper::GetAllPublicIds(Json::Value& target,
473 ResourceType resourceType)
474 {
475 SQLite::Statement s(db_, SQLITE_FROM_HERE, "SELECT publicId FROM Resources WHERE resourceType=?");
476 s.BindInt(0, resourceType);
477
478 target = Json::arrayValue;
479 while (s.Step())
480 {
481 target.append(s.ColumnString(0));
482 }
483 }
484
472 485
473 DatabaseWrapper::DatabaseWrapper(const std::string& path, 486 DatabaseWrapper::DatabaseWrapper(const std::string& path,
474 IServerIndexListener& listener) : 487 IServerIndexListener& listener) :
475 listener_(listener) 488 listener_(listener)
476 { 489 {