comparison OrthancServer/DatabaseWrapper.cpp @ 197:530a25320461

removal of text as ids in sqlite db
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Nov 2012 14:59:55 +0100
parents a1b9d1e1497b
children 663cc6c46d0a
comparison
equal deleted inserted replaced
196:6d0225a26fd8 197:530a25320461
314 return defaultValue; 314 return defaultValue;
315 } 315 }
316 } 316 }
317 317
318 void DatabaseWrapper::AttachFile(int64_t id, 318 void DatabaseWrapper::AttachFile(int64_t id,
319 const std::string& contentName, 319 AttachedFileType contentType,
320 const std::string& fileUuid, 320 const std::string& fileUuid,
321 uint64_t compressedSize, 321 uint64_t compressedSize,
322 uint64_t uncompressedSize, 322 uint64_t uncompressedSize,
323 CompressionType compressionType) 323 CompressionType compressionType)
324 { 324 {
325 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO AttachedFiles VALUES(?, ?, ?, ?, ?, ?)"); 325 SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO AttachedFiles VALUES(?, ?, ?, ?, ?, ?)");
326 s.BindInt(0, id); 326 s.BindInt(0, id);
327 s.BindString(1, contentName); 327 s.BindInt(1, contentType);
328 s.BindString(2, fileUuid); 328 s.BindString(2, fileUuid);
329 s.BindInt(3, compressedSize); 329 s.BindInt(3, compressedSize);
330 s.BindInt(4, uncompressedSize); 330 s.BindInt(4, uncompressedSize);
331 s.BindInt(5, compressionType); 331 s.BindInt(5, compressionType);
332 s.Run(); 332 s.Run();
333 } 333 }
334 334
335 bool DatabaseWrapper::LookupFile(int64_t id, 335 bool DatabaseWrapper::LookupFile(int64_t id,
336 const std::string& contentName, 336 AttachedFileType contentType,
337 std::string& fileUuid, 337 std::string& fileUuid,
338 uint64_t& compressedSize, 338 uint64_t& compressedSize,
339 uint64_t& uncompressedSize, 339 uint64_t& uncompressedSize,
340 CompressionType& compressionType) 340 CompressionType& compressionType)
341 { 341 {
342 SQLite::Statement s(db_, SQLITE_FROM_HERE, 342 SQLite::Statement s(db_, SQLITE_FROM_HERE,
343 "SELECT uuid, compressedSize, uncompressedSize, compressionType FROM AttachedFiles WHERE id=? AND contentName=?"); 343 "SELECT uuid, compressedSize, uncompressedSize, compressionType FROM AttachedFiles WHERE id=? AND fileType=?");
344 s.BindInt(0, id); 344 s.BindInt(0, id);
345 s.BindString(1, contentName); 345 s.BindInt(1, contentType);
346 346
347 if (!s.Step()) 347 if (!s.Step())
348 { 348 {
349 return false; 349 return false;
350 } 350 }