]> Creatis software - creaImageIO.git/blobdiff - src2/creaImageIOSynchron.cpp
move directory
[creaImageIO.git] / src2 / creaImageIOSynchron.cpp
index f7e1807b0908b5a0ff82324c3fef40004d0bc89e..0955ffaee260161d386f73b4391d220c5e3c314d 100644 (file)
@@ -2,9 +2,10 @@
 #include <creaImageIOSystem.h>
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
-//namespace fs = boost::filesystem;
 
 
+//namespace fs = boost::filesystem;
+
 //=====================================================================
  
 
@@ -47,7 +48,7 @@ namespace creaImageIO
    //=====================================================================
     Synchronizer::~Synchronizer()
     {
-       
+       delete mDB;
     }
 
        //=====================================================================
@@ -386,14 +387,41 @@ namespace creaImageIO
     // @param : the add key
     //@result : list (path) of ignore files
     /////////////////////////////////////////////////////////////////////////////////////////////////
-    void Synchronizer::GetList()
+       void Synchronizer::GetList(const std::string i_db)
     {
-       mList.clear();
+               mList.clear();
         std::vector<std::string> i_names;
-       std::string query = "SELECT PATH, REMOVE FROM IGNORED_FILES";
-       CppSQLite3Query res;
+               std::vector<std::string> keys;
+               CppSQLite3Query res;
+               std::string query ="SELECT ADD_KEY, REFERENCEDDB FROM  ADD_OPS";
+               QUERYSYNCDB(query, res);
+               keys.clear();
+               while (!res.eof())
+        {
+                       std::string key(res.getStringField(0));
+                       std::string db(res.getStringField(1));
+                       if (db == i_db)
+                       {
+                               keys.push_back(key);
+                       }
+                       res.nextRow();
+               }
+               query = "SELECT PATH, REMOVE FROM IGNORED_FILES WHERE";
+               if(keys.size() > 0)
+               {
+                       for (int i=0; i < keys.size(); i++)
+                       {
+                               query += " ADD_KEY = " + keys[i];
+                               query += " AND";
+                       }
+                       query = query.substr(0,query.size() - 4);
+               }
+               else 
+               {
+                       query += " ADD_KEY = -1";
+               }
         QUERYSYNCDB(query, res);
-       while (!res.eof())
+               while (!res.eof())
         {
                std::string file(res.getStringField(0));
                std::string ignore(res.getStringField(1));