Index: src/libchcore/TSQLiteTaskSchema.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -r410f8f7b06e7639102eff1021e523b3cfdc185a2 --- src/libchcore/TSQLiteTaskSchema.cpp (.../TSQLiteTaskSchema.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TSQLiteTaskSchema.cpp (.../TSQLiteTaskSchema.cpp) (revision 410f8f7b06e7639102eff1021e523b3cfdc185a2) @@ -56,6 +56,9 @@ if (tVersion.GetVersion() == 3) Migrate_003_004(spDatabase, tVersion); + + if(tVersion.GetVersion() == 4) + Migrate_004_005(spDatabase, tVersion); } tTransaction.Commit(); @@ -101,6 +104,11 @@ _T("buffer_index INT NOT NULL, current_path varchar(32768) NOT NULL, ci_silent_resume boolean NOT NULL)")); tStatement.Step(); + tStatement.Prepare(_T("CREATE TABLE subtask_scan(id BIGINT UNIQUE, current_index INT NOT NULL, is_running boolean NOT NULL, is_initialized boolean NOT NULL, total_size BIGINT NOT NULL, processed_size BIGINT NOT NULL, size_speed varchar(1024) NOT NULL, ") + _T("total_count BIGINT NOT NULL, processed_count BIGINT NOT NULL, count_speed varchar(1024) NOT NULL, ci_processed_size BIGINT NOT NULL, ci_total_size BIGINT NOT NULL, timer BIGINT NOT NULL, ") + _T("buffer_index INT NOT NULL, current_path varchar(32768) NOT NULL, ci_silent_resume boolean NOT NULL)")); + tStatement.Step(); + tStatement.Prepare(_T("CREATE TABLE subtask_delete(id BIGINT UNIQUE, current_index INT NOT NULL, is_running boolean NOT NULL, is_initialized boolean NOT NULL, total_size BIGINT NOT NULL, processed_size BIGINT NOT NULL, size_speed varchar(1024) NOT NULL, ") _T("total_count BIGINT NOT NULL, processed_count BIGINT NOT NULL, count_speed varchar(1024) NOT NULL, ci_processed_size BIGINT NOT NULL, ci_total_size BIGINT NOT NULL, timer BIGINT NOT NULL, ") _T("buffer_index INT NOT NULL, current_path varchar(32768) NOT NULL, ci_silent_resume boolean NOT NULL)")); @@ -115,7 +123,7 @@ tStatement.Step(); // and finally set the database version to current one - tVersion.SetVersion(4); + tVersion.SetVersion(5); } void TSQLiteTaskSchema::Migrate_001_002(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion) @@ -214,4 +222,17 @@ tVersion.SetVersion(4); } + + void TSQLiteTaskSchema::Migrate_004_005(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion) + { + sqlite::TSQLiteStatement tStatement(spDatabase); + + // new table for scan stats + tStatement.Prepare(_T("CREATE TABLE subtask_scan(id BIGINT UNIQUE, current_index INT NOT NULL, is_running boolean NOT NULL, is_initialized boolean NOT NULL, total_size BIGINT NOT NULL, processed_size BIGINT NOT NULL, size_speed varchar(1024) NOT NULL, ") + _T("total_count BIGINT NOT NULL, processed_count BIGINT NOT NULL, count_speed varchar(1024) NOT NULL, ci_processed_size BIGINT NOT NULL, ci_total_size BIGINT NOT NULL, timer BIGINT NOT NULL, ") + _T("buffer_index INT NOT NULL, current_path varchar(32768) NOT NULL, ci_silent_resume boolean NOT NULL)")); + tStatement.Step(); + + tVersion.SetVersion(5); + } } Index: src/libchcore/TSQLiteTaskSchema.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r410f8f7b06e7639102eff1021e523b3cfdc185a2 --- src/libchcore/TSQLiteTaskSchema.h (.../TSQLiteTaskSchema.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TSQLiteTaskSchema.h (.../TSQLiteTaskSchema.h) (revision 410f8f7b06e7639102eff1021e523b3cfdc185a2) @@ -40,6 +40,7 @@ void Migrate_001_002(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion); void Migrate_002_003(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion); void Migrate_003_004(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion); + void Migrate_004_005(const sqlite::TSQLiteDatabasePtr& spDatabase, TSerializerVersion &tVersion); }; typedef boost::shared_ptr TSQLiteTaskSchemaPtr; Index: src/libchcore/TSubTaskScanDirectory.cpp =================================================================== diff -u -ra27d1acf1bda3c25b6dcce0d0eb0278009ce63ae -r410f8f7b06e7639102eff1021e523b3cfdc185a2 --- src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision a27d1acf1bda3c25b6dcce0d0eb0278009ce63ae) +++ src/libchcore/TSubTaskScanDirectory.cpp (.../TSubTaskScanDirectory.cpp) (revision 410f8f7b06e7639102eff1021e523b3cfdc185a2) @@ -255,14 +255,32 @@ return 0; } - void TSubTaskScanDirectories::Store(const ISerializerPtr& spSerializer) const { - spSerializer; + ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_scan")); + + InitColumns(spContainer); + + ISerializerRowData& rRow = spContainer->GetRow(0, m_tSubTaskStats.WasAdded()); + + m_tSubTaskStats.Store(rRow); } void TSubTaskScanDirectories::Load(const ISerializerPtr& spSerializer) { - spSerializer; + ISerializerContainerPtr spContainer = spSerializer->GetContainer(_T("subtask_scan")); + + InitColumns(spContainer); + + ISerializerRowReaderPtr spRowReader = spContainer->GetRowReader(); + if(spRowReader->Next()) + m_tSubTaskStats.Load(spRowReader); } + + void TSubTaskScanDirectories::InitColumns(const ISerializerContainerPtr& spContainer) const + { + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + if(rColumns.IsEmpty()) + TSubTaskStatsInfo::InitColumns(rColumns); + } } Index: src/libchcore/TSubTaskScanDirectory.h =================================================================== diff -u -rcb4e9d4b60d62b25ae2cf556c0642601af56c787 -r410f8f7b06e7639102eff1021e523b3cfdc185a2 --- src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision cb4e9d4b60d62b25ae2cf556c0642601af56c787) +++ src/libchcore/TSubTaskScanDirectory.h (.../TSubTaskScanDirectory.h) (revision 410f8f7b06e7639102eff1021e523b3cfdc185a2) @@ -56,6 +56,7 @@ private: int ScanDirectory(TSmartPath pathDirName, const TBasePathDataPtr& spBasePathData, bool bRecurse, bool bIncludeDirs, const TFileFiltersArray& afFilters); + void InitColumns(const ISerializerContainerPtr& spContainer) const; private: #pragma warning(push) Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -re8f31b0f922b402878356e130c866c4f3682a7f5 -r410f8f7b06e7639102eff1021e523b3cfdc185a2 --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision e8f31b0f922b402878356e130c866c4f3682a7f5) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision 410f8f7b06e7639102eff1021e523b3cfdc185a2) @@ -338,9 +338,9 @@ if (m_fcTotalCount.IsModified()) rRowData.SetValue(_T("total_count"), m_fcTotalCount); - if (m_ullProcessedSize.IsModified()) + if (m_fcProcessedCount.IsModified()) rRowData.SetValue(_T("processed_count"), m_fcProcessedCount); - if (m_tSizeSpeed.IsModified()) + if (m_tCountSpeed.IsModified()) rRowData.SetValue(_T("count_speed"), m_tCountSpeed.Get().ToString()); if (m_ullCurrentItemProcessedSize.IsModified())