Explorar o código

New internal method to create a backup filelist

This could be used e.g. for reindexing everything
with a new database schema.
Marco Nolden %!s(int64=13) %!d(string=hai) anos
pai
achega
b4c33cebd2
Modificáronse 1 ficheiros con 13 adicións e 0 borrados
  1. 13 0
      Libs/DICOM/Core/ctkDICOMDatabase.cpp

+ 13 - 0
Libs/DICOM/Core/ctkDICOMDatabase.cpp

@@ -85,6 +85,10 @@ public:
   // filePath has to be set if this is an import of an actual file
   void insert ( const ctkDICOMDataset& ctkDataset, const QString& filePath, bool storeFile = true, bool generateThumbnail = true);
 
+  ///
+  /// copy the complete list of files to an extra table
+  ///
+  void createBackupFileList();
 
   /// Name of the database file (i.e. for SQLITE the sqlite file)
   QString      DatabaseFileName;
@@ -181,6 +185,15 @@ bool ctkDICOMDatabasePrivate::loggedExec(QSqlQuery& query, const QString& queryS
 }
 
 //------------------------------------------------------------------------------
+void ctkDICOMDatabasePrivate::createBackupFileList()
+{
+  QSqlQuery query(this->Database);
+  loggedExec(query, "CREATE TABLE IF NOT EXISTS main.Filenames_backup (Filename TEXT PRIMARY KEY NOT NULL )" );
+  loggedExec(query, "INSERT INTO Filenames_backup SELECT Filename FROM Images;" );
+}
+
+
+//------------------------------------------------------------------------------
 void ctkDICOMDatabase::openDatabase(const QString databaseFile, const QString& connectionName )
 {
   Q_D(ctkDICOMDatabase);