diff 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
line wrap: on
line diff
--- a/OrthancServer/DatabaseWrapper.cpp	Fri Nov 16 08:23:05 2012 +0100
+++ b/OrthancServer/DatabaseWrapper.cpp	Tue Nov 27 14:59:55 2012 +0100
@@ -316,7 +316,7 @@
   }
 
   void DatabaseWrapper::AttachFile(int64_t id,
-                                   const std::string& contentName,
+                                   AttachedFileType contentType,
                                    const std::string& fileUuid,
                                    uint64_t compressedSize,
                                    uint64_t uncompressedSize,
@@ -324,7 +324,7 @@
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, "INSERT INTO AttachedFiles VALUES(?, ?, ?, ?, ?, ?)");
     s.BindInt(0, id);
-    s.BindString(1, contentName);
+    s.BindInt(1, contentType);
     s.BindString(2, fileUuid);
     s.BindInt(3, compressedSize);
     s.BindInt(4, uncompressedSize);
@@ -333,16 +333,16 @@
   }
 
   bool DatabaseWrapper::LookupFile(int64_t id,
-                                   const std::string& contentName,
+                                   AttachedFileType contentType,
                                    std::string& fileUuid,
                                    uint64_t& compressedSize,
                                    uint64_t& uncompressedSize,
                                    CompressionType& compressionType)
   {
     SQLite::Statement s(db_, SQLITE_FROM_HERE, 
-                        "SELECT uuid, compressedSize, uncompressedSize, compressionType FROM AttachedFiles WHERE id=? AND contentName=?");
+                        "SELECT uuid, compressedSize, uncompressedSize, compressionType FROM AttachedFiles WHERE id=? AND fileType=?");
     s.BindInt(0, id);
-    s.BindString(1, contentName);
+    s.BindInt(1, contentType);
 
     if (!s.Step())
     {