Index: src/ch/ch.cpp =================================================================== diff -u -rb1e03eb232a784d6e2d40f67cbbbb33be0972228 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/ch/ch.cpp (.../ch.cpp) (revision b1e03eb232a784d6e2d40f67cbbbb33be0972228) +++ src/ch/ch.cpp (.../ch.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -27,6 +27,14 @@ #include "../common/version.h" #include "TCommandLineParser.h" #include "../libchcore/TStringSet.h" +#include "../libchcore/TSimpleTimer.h" +#include "../libchcore/SerializerTrace.h" +#include +#include "../libchcore/TSQLiteTaskSchema.h" +#include "../libchcore/TSQLiteSerializer.h" +#include "../libchcore/ISerializerContainer.h" +#include "../libchcore/ISerializerRowData.h" +#include "../libchcore/TFileInfo.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -191,8 +199,52 @@ return EXCEPTION_EXECUTE_HANDLER; } +//#define DO_TEST + BOOL CCopyHandlerApp::InitInstance() { +#ifdef DO_TEST + using namespace chcore; + + TSimpleTimer timer(true); + + { + DeleteFile(_T("C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\test.sqlite")); + TSQLiteTaskSchemaPtr spTaskSchema(new TSQLiteTaskSchema); + + // TSQLiteSerializer serializer(PathFromString(_T("C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\test.sqlite")), spTaskSchema); + TSQLiteSerializer serializer(PathFromString(_T(":memory:")), spTaskSchema); + ISerializerContainerPtr spContainer = serializer.GetContainer(_T("scanned_files")); + + IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); + TFileInfo::InitColumns(rColumns); + + for(size_t stIndex = 0; stIndex < 200000; ++stIndex) + { + ISerializerRowData& rRow = spContainer->GetRow(stIndex, true); + rRow.SetValue(_T("rel_path"), PathFromString(_T("C:\\Users\\ixen\\AppData\\Local\\Copy Handler\\Tasks\\sometask.xxx"))); + rRow.SetValue(_T("base_path_id"), 24735275ull); + rRow.SetValue(_T("attr"), 0x56533234ul); + rRow.SetValue(_T("size"), 0x565332340897ff12ull); + rRow.SetValue(_T("time_created"), 0x565332340897ff12ull); + rRow.SetValue(_T("time_last_write"), 0x565122340897ff12ull); + rRow.SetValue(_T("time_last_access"), 0x565517840897ff12ull); + rRow.SetValue(_T("flags"), 0x56551114u); + } + + unsigned long long ullFillTime = timer.Checkpoint(); ullFillTime; + GTRACE1(_T("***** [FillTime]: %I64u ms\n"), ullFillTime); + + serializer.Flush(); + unsigned long long ullFlushTime = timer.Checkpoint(); ullFlushTime; + GTRACE1(_T("***** [FlushTime]: %I64u ms\n"), ullFlushTime); + } + + unsigned long long ullDestructTime = timer.Checkpoint(); ullDestructTime; + GTRACE1(_T("***** [DestructTime]: %I64u ms\n"), ullDestructTime); + + return FALSE; +#else // ================================= Crash handling ======================================= SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter); @@ -371,6 +423,7 @@ LOG_INFO(_T("Copy Handler initialized successfully")); return TRUE; +#endif } void CCopyHandlerApp::InitShellExtension() Index: src/libchcore/IColumnsDefinition.h =================================================================== diff -u -r213cc1a2b3530ea7cb31fd0dac258df23bcc3416 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision 213cc1a2b3530ea7cb31fd0dac258df23bcc3416) +++ src/libchcore/IColumnsDefinition.h (.../IColumnsDefinition.h) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -39,7 +39,6 @@ eType_ulong, eType_longlong, eType_ulonglong, - eType_sizet, eType_double, eType_string, eType_path, Index: src/libchcore/TBasePathData.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TBasePathData.cpp (.../TBasePathData.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -110,7 +110,7 @@ void TBasePathData::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_long); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("src_path"), IColumnsDefinition::eType_path); rColumns.AddColumn(_T("skip_processing"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("dst_path"), IColumnsDefinition::eType_path); Index: src/libchcore/TConfig.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TConfig.cpp (.../TConfig.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -195,6 +195,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("name"), IColumnsDefinition::eType_string); rColumns.AddColumn(_T("node_order"), IColumnsDefinition::eType_int); rColumns.AddColumn(_T("value"), IColumnsDefinition::eType_string); Index: src/libchcore/TFileFilter.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TFileFilter.cpp (.../TFileFilter.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -538,7 +538,7 @@ void TFileFilter::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("use_mask"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("mask"), IColumnsDefinition::eType_string); rColumns.AddColumn(_T("use_exclude_mask"), IColumnsDefinition::eType_bool); Index: src/libchcore/TFileInfo.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TFileInfo.cpp (.../TFileInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -275,9 +275,9 @@ void TFileInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("rel_path"), IColumnsDefinition::eType_path); - rColumns.AddColumn(_T("base_path_id"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("base_path_id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("attr"), IColumnsDefinition::eType_ulong); rColumns.AddColumn(_T("size"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("time_created"), IColumnsDefinition::eType_ulonglong); Index: src/libchcore/TModPathContainer.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TModPathContainer.cpp (.../TModPathContainer.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -330,7 +330,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("path"), IColumnsDefinition::eType_path); } } Index: src/libchcore/TSQLiteColumnDefinition.cpp =================================================================== diff -u -rfc67a825635691930b3ac00dc95b16e59f3d2fae -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteColumnDefinition.cpp (.../TSQLiteColumnDefinition.cpp) (revision fc67a825635691930b3ac00dc95b16e59f3d2fae) +++ src/libchcore/TSQLiteColumnDefinition.cpp (.../TSQLiteColumnDefinition.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -83,4 +83,9 @@ return strColumns; } +IColumnsDefinition::ETypes TSQLiteColumnsDefinition::GetColumnType(size_t stIndex) const +{ + return m_vColumns.at(stIndex).second; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TSQLiteColumnDefinition.h =================================================================== diff -u -r213cc1a2b3530ea7cb31fd0dac258df23bcc3416 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteColumnDefinition.h (.../TSQLiteColumnDefinition.h) (revision 213cc1a2b3530ea7cb31fd0dac258df23bcc3416) +++ src/libchcore/TSQLiteColumnDefinition.h (.../TSQLiteColumnDefinition.h) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -36,6 +36,7 @@ virtual void Clear(); virtual size_t GetColumnIndex(const TString& strColumnName); + virtual ETypes GetColumnType(size_t stIndex) const; virtual TString GetColumnName(size_t stIndex) const; virtual size_t GetCount() const; virtual bool IsEmpty() const; Index: src/libchcore/TSQLiteSerializerContainer.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSQLiteSerializerContainer.cpp (.../TSQLiteSerializerContainer.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -26,33 +26,40 @@ #include "TSQLiteSerializerRowReader.h" #include "TRemovedObjects.h" #include "SerializerTrace.h" +#include +#include "TSerializerException.h" BEGIN_CHCORE_NAMESPACE using namespace sqlite; TSQLiteSerializerContainer::TSQLiteSerializerContainer(const TString& strName, const sqlite::TSQLiteDatabasePtr& spDB) : m_strName(strName), - m_spDB(spDB) + m_spDB(spDB), + m_pPoolRows(NULL) { } -TSQLiteSerializerContainer::TSQLiteSerializerContainer(const TString& strName, size_t stParentID, const sqlite::TSQLiteDatabasePtr& spDB) : - m_stParentID(stParentID), - m_strName(strName), - m_spDB(spDB) -{ -} - TSQLiteSerializerContainer::~TSQLiteSerializerContainer() { + // get rid of all rows first + m_mapRows.clear(); + + // now get rid of memory pool + delete m_pPoolRows; } ISerializerRowData& TSQLiteSerializerContainer::GetRow(size_t stRowID, bool bMarkAsAdded) { RowMap::iterator iterFnd = m_mapRows.find(stRowID); if(iterFnd == m_mapRows.end()) - iterFnd = m_mapRows.insert(std::make_pair(stRowID, TSQLiteSerializerRowData(stRowID, m_tColumns, bMarkAsAdded))).first; + { + void* pMemoryBlock = GetPool().malloc(); + if(!pMemoryBlock) + THROW_SERIALIZER_EXCEPTION(eErr_InternalProblem, _T("Cannot allocate memory")); + + iterFnd = m_mapRows.insert(std::make_pair(stRowID, TSQLiteSerializerRowData(stRowID, m_tColumns, bMarkAsAdded, (unsigned long long*)pMemoryBlock, GetPool().get_requested_size()))).first; + } else if(bMarkAsAdded) iterFnd->second.MarkAsAdded(); @@ -93,12 +100,12 @@ FlushDeletions(); // group rows that can be executed with one preparation - std::map> mapGroups; - std::map>::iterator iterMapGroups; + std::map> mapGroups; + std::map>::iterator iterMapGroups; for(RowMap::iterator iterRows = m_mapRows.begin(); iterRows != m_mapRows.end(); ++iterRows) { - TRowID rowID = iterRows->second.GetChangeIdentification(); + unsigned long long rowID = iterRows->second.GetChangeIdentification(); iterMapGroups = mapGroups.find(rowID); if(iterMapGroups == mapGroups.end()) iterMapGroups = mapGroups.insert(std::make_pair(rowID, std::vector())).first; @@ -110,24 +117,26 @@ for(iterMapGroups = mapGroups.begin(); iterMapGroups != mapGroups.end(); ++iterMapGroups) { - if(iterMapGroups->first.HasAny()) + if(iterMapGroups->first != 0) { std::vector& rGroupRows = iterMapGroups->second; // query is generated from the first item in a group TString strQuery = rGroupRows.front()->GetQuery(m_strName); + if(!strQuery.IsEmpty()) + { + DBTRACE2(_T("Preparing query for %lu records: %s\n"), (unsigned long)iterMapGroups->second.size(), (PCTSTR)strQuery); - DBTRACE2(_T("Preparing query for %lu records: %s\n"), (unsigned long)iterMapGroups->second.size(), (PCTSTR)strQuery); + tStatement.Prepare(strQuery); - tStatement.Prepare(strQuery); + for(std::vector::iterator iterRow = iterMapGroups->second.begin(); iterRow != iterMapGroups->second.end(); ++iterRow) + { + (*iterRow)->BindParamsAndExec(tStatement); + tStatement.ClearBindings(); + } - for(std::vector::iterator iterRow = iterMapGroups->second.begin(); iterRow != iterMapGroups->second.end(); ++iterRow) - { - (*iterRow)->BindParamsAndExec(tStatement); - tStatement.ClearBindings(); + tStatement.Close(); } - - tStatement.Close(); } } } @@ -160,4 +169,28 @@ } } +boost::pool<>& TSQLiteSerializerContainer::GetPool() +{ + if(!m_pPoolRows) + m_pPoolRows = new boost::pool<>(CalculateRowMemorySize()); + else + { + if(m_pPoolRows->get_requested_size() != CalculateRowMemorySize()) + THROW_SERIALIZER_EXCEPTION(eErr_InternalProblem, _T("Column count changed after first use")); + } + + return *m_pPoolRows; +} + +size_t TSQLiteSerializerContainer::CalculateRowMemorySize() const +{ + // assume 64bit column mask (8 bytes) + const size_t stMaskSize = 8; + + // and additionally 64bit for each column (either for storing numbers directly or for allocating string/double) + const size_t stFieldSize = 8; + + return stMaskSize + m_tColumns.GetCount() * stFieldSize; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TSQLiteSerializerContainer.h =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSQLiteSerializerContainer.h (.../TSQLiteSerializerContainer.h) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -24,18 +24,18 @@ #include "ISerializerContainer.h" #include #include +#include #include "TSQLiteColumnDefinition.h" #include "TSQLiteDatabase.h" #include "TSQLiteSerializerRowData.h" +#include BEGIN_CHCORE_NAMESPACE class LIBCHCORE_API TSQLiteSerializerContainer : public ISerializerContainer { public: TSQLiteSerializerContainer(const TString& strName, const sqlite::TSQLiteDatabasePtr& spDB); - TSQLiteSerializerContainer(const TString& strName, size_t stParentID, const sqlite::TSQLiteDatabasePtr& spDB); - virtual ~TSQLiteSerializerContainer(); virtual IColumnsDefinition& GetColumnsDefinition(); @@ -50,17 +50,19 @@ private: void FlushDeletions(); + boost::pool<>& GetPool(); + size_t CalculateRowMemorySize() const; private: #pragma warning(push) #pragma warning(disable: 4251) - boost::optional m_stParentID; + TSQLiteColumnsDefinition m_tColumns; - typedef std::map RowMap; // maps row id to row data + boost::pool<>* m_pPoolRows; + + typedef boost::container::flat_map RowMap; // maps row id to row data RowMap m_mapRows; - TSQLiteColumnsDefinition m_tColumns; - std::set m_setDeleteItems; TString m_strName; Index: src/libchcore/TSQLiteSerializerRowData.cpp =================================================================== diff -u -r3933d378c75e0b245a6ccb91099eaeb2c5728209 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision 3933d378c75e0b245a6ccb91099eaeb2c5728209) +++ src/libchcore/TSQLiteSerializerRowData.cpp (.../TSQLiteSerializerRowData.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -26,227 +26,165 @@ BEGIN_CHCORE_NAMESPACE -namespace -{ - struct SQLiteBindValueVisitor : public boost::static_visitor<> - { - private: - SQLiteBindValueVisitor& operator=(const SQLiteBindValueVisitor&); - - public: - SQLiteBindValueVisitor(sqlite::TSQLiteStatement& rStatement, int& rColumn) : m_rStatement(rStatement), m_rColumn(rColumn) {} - - void operator()(TSQLiteSerializerRowData::ENullType) const - { - } - - void operator()(bool value) const - { - DBTRACE1_D(_T("- param(bool): %ld\n"), value ? 1l : 0l); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(short value) const - { - DBTRACE1_D(_T("- param(short): %d\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(unsigned short value) const - { - DBTRACE1_D(_T("- param(ushort): %u\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(int value) const - { - DBTRACE1_D(_T("- param(int): %ld\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(unsigned int value) const - { - DBTRACE1_D(_T("- param(uint): %lu\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(long value) const - { - DBTRACE1_D(_T("- param(long): %ld\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(unsigned long value) const - { - DBTRACE1_D(_T("- param(ulong): %lu\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(long long value) const - { - DBTRACE1_D(_T("- param(longlong): %I64d\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(unsigned long long value) const - { - DBTRACE1_D(_T("- param(ulonglong): %I64u\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(double value) const - { - DBTRACE1_D(_T("- param(double): %f\n"), value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(const TString& value) const - { - DBTRACE1_D(_T("- param(string): '%s'\n"), (PCTSTR)value); - m_rStatement.BindValue(m_rColumn++, value); - } - - void operator()(const TSmartPath& value) const - { - DBTRACE1_D(_T("- param(path): %s\n"), value.ToString()); - m_rStatement.BindValue(m_rColumn++, value); - } - - int& m_rColumn; - sqlite::TSQLiteStatement& m_rStatement; - }; -} - /////////////////////////////////////////////////////////////////////////// -TRowID::TRowID(const TSQLiteColumnsDefinition& rColumnDefinition) : - m_bitset(rColumnDefinition.GetCount() + 1) // count of columns and a bit for add/modify +TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes) : + m_rColumns(rColumnDefinition), + m_pPoolMemory(pPoolMemory) { -} + if(!m_pPoolMemory) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Null memory provided")); + if(rColumnDefinition.GetCount() > 63) + THROW_SERIALIZER_EXCEPTION(eErr_InternalProblem, _T("Serializer supports up to 63 columns. If more is needed the block header needs to be increased.")); -TRowID::~TRowID() -{ -} + // initialize memory + memset((void*)pPoolMemory, 0, stPoolMemorySizeInBytes); -void TRowID::SetAddedBit(bool bAdded) -{ - m_bitset[0] = bAdded; -} + // set id + size_t stIDIndex = rColumnDefinition.GetColumnIndex(_T("id")); + SetValue(stIDIndex, (unsigned long long)stRowID); -void TRowID::SetColumnBit(size_t stIndex, bool bColumnExists) -{ - ++stIndex; - - if(stIndex >= m_bitset.size()) - THROW_SERIALIZER_EXCEPTION(eErr_BoundsExceeded, _T("Row identification info cannot be generated")); - - m_bitset[stIndex] = bColumnExists; + if(bAdded) + MarkAsAdded(); } -bool TRowID::operator==(const TRowID rSrc) const -{ - return m_bitset == rSrc.m_bitset; -} - -bool TRowID::operator<(const TRowID rSrc) const -{ - return m_bitset < rSrc.m_bitset; -} - -void TRowID::Clear() -{ - m_bitset.reset(); -} - -bool TRowID::HasAny() const -{ - return m_bitset.any(); -} - -/////////////////////////////////////////////////////////////////////////// -TSQLiteSerializerRowData::TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded) : - m_stRowID(stRowID), - m_rColumns(rColumnDefinition), - m_bAdded(bAdded) -{ - m_vValues.resize(rColumnDefinition.GetCount()); -} - TSQLiteSerializerRowData::TSQLiteSerializerRowData(const TSQLiteSerializerRowData& rSrc) : - m_stRowID(rSrc.m_stRowID), - m_bAdded(rSrc.m_bAdded), m_rColumns(rSrc.m_rColumns), - m_vValues(rSrc.m_vValues) + m_pPoolMemory(rSrc.m_pPoolMemory) { } TSQLiteSerializerRowData::~TSQLiteSerializerRowData() { + // do not delete m_pPoolMemory as it does not belong to us + // but delete all additional memory allocated for items + FreeAllColumnData(); } -ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, const InternalVariant& rData) +ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, bool bValue) { - m_vValues.at(stColIndex) = rData; + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_bool) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (bValue ? 1ULL : 0ULL); return *this; } -ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, bool bValue) -{ - return SetValue(stColIndex, InternalVariant(bValue)); -} - ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, short siValue) { - return SetValue(stColIndex, InternalVariant(siValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_short) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)*(unsigned short*)&siValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, unsigned short usiValue) { - return SetValue(stColIndex, InternalVariant(usiValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_ushort) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)usiValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, int iValue) { - return SetValue(stColIndex, InternalVariant(iValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_int) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)*(unsigned int*)&iValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, unsigned int uiValue) { - return SetValue(stColIndex, InternalVariant(uiValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_uint) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)uiValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, long lValue) { - return SetValue(stColIndex, InternalVariant(lValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_long) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)*(unsigned long*)&lValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, unsigned long ulValue) { - return SetValue(stColIndex, InternalVariant(ulValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_ulong) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = (unsigned long long)ulValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, long long llValue) { - return SetValue(stColIndex, InternalVariant(llValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_longlong) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = *(unsigned long long*)&llValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, unsigned long long ullValue) { - return SetValue(stColIndex, InternalVariant(ullValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_ulonglong) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + ModifyColumnData(stColIndex) = ullValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, double dValue) { - return SetValue(stColIndex, InternalVariant(dValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_double) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + BOOST_STATIC_ASSERT(sizeof(double) == sizeof(unsigned long long)); + ModifyColumnData(stColIndex) = *(unsigned long long*)&dValue; + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, const TString& strValue) { - return SetValue(stColIndex, InternalVariant(strValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_string) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + if(strValue.IsEmpty()) + ModifyColumnData(stColIndex) = (unsigned long long)0; + else + { + const size_t stBufferChars = strValue.GetLength() + 1; + wchar_t* pszBuffer = new wchar_t[stBufferChars]; + wcsncpy_s(pszBuffer, stBufferChars, (const wchar_t*)strValue, stBufferChars); + ModifyColumnData(stColIndex) = (unsigned long long)(void*)pszBuffer; + } + + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(size_t stColIndex, const TSmartPath& pathValue) { - return SetValue(stColIndex, InternalVariant(pathValue)); + if(m_rColumns.GetColumnType(stColIndex) != IColumnsDefinition::eType_path) + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid argument type provided")); + + if(pathValue.IsEmpty()) + ModifyColumnData(stColIndex) = (unsigned long long)0; + else + { + const size_t stBufferChars = pathValue.GetLength() + 1; + wchar_t* pszBuffer = new wchar_t[stBufferChars]; + wcsncpy_s(pszBuffer, stBufferChars, pathValue.ToString(), stBufferChars); + ModifyColumnData(stColIndex) = (unsigned long long)(void*)pszBuffer; + } + + return *this; } ISerializerRowData& TSQLiteSerializerRowData::SetValue(const TString& strColumnName, bool bValue) @@ -313,27 +251,24 @@ { using namespace sqlite; - if(m_bAdded) + if(IsAdded()) { // exec query int iColumn = 1; - tStatement.BindValue(iColumn++, m_stRowID); - for(VecVariants::iterator iterVariant = m_vValues.begin(); iterVariant != m_vValues.end(); ++iterVariant) - { - boost::apply_visitor(SQLiteBindValueVisitor(tStatement, iColumn), *iterVariant); - } + BindParams(tStatement, iColumn); tStatement.Step(); } - else if(!m_vValues.empty()) + else if(HasAnyData()) { int iColumn = 1; - for(VecVariants::iterator iterVariant = m_vValues.begin(); iterVariant != m_vValues.end(); ++iterVariant) - { - boost::apply_visitor(SQLiteBindValueVisitor(tStatement, iColumn), *iterVariant); - } - tStatement.BindValue(iColumn++, m_stRowID); + size_t stIDColumnIndex = m_rColumns.GetColumnIndex(_T("id")); + + BindParams(tStatement, iColumn, stIDColumnIndex); + + // bind id as the last argument + tStatement.BindValue(iColumn++, GetDataForColumn(stIDColumnIndex)); tStatement.Step(); int iChanges = tStatement.Changes(); @@ -345,43 +280,48 @@ TString TSQLiteSerializerRowData::GetQuery(const TString& strContainerName) const { - if(m_bAdded) + if(IsAdded()) { // prepare insert query - TString strQuery = boost::str(boost::wformat(L"INSERT INTO %1%(id,") % strContainerName).c_str(); + TString strQuery = boost::str(boost::wformat(L"INSERT INTO %1%(") % strContainerName).c_str(); TString strParams; - for(size_t stIndex = 0; stIndex < m_vValues.size(); ++stIndex) + size_t stCount = m_rColumns.GetCount(); + for(size_t stIndex = 0; stIndex < stCount; ++stIndex) { - if(m_vValues[stIndex].which() != 0) // not for eNull values (0th element of variant) - { - strQuery += boost::str(boost::wformat(_T("%1%,")) % m_rColumns.GetColumnName(stIndex)).c_str(); - strParams += _T("?,"); - } + strQuery += boost::str(boost::wformat(_T("%1%,")) % m_rColumns.GetColumnName(stIndex)).c_str(); + strParams += _T("?,"); } strQuery.TrimRightSelf(_T(",")); - strQuery += _T(") VALUES(?,"); + strQuery += _T(") VALUES("); strParams.TrimRightSelf(_T(",")); strQuery += strParams; strQuery += _T(")"); return strQuery; } - else if(!m_vValues.empty()) + else if(HasAnyData()) { // prepare update query TString strQuery = boost::str(boost::wformat(L"UPDATE %1% SET ") % strContainerName).c_str(); - for(size_t stIndex = 0; stIndex < m_vValues.size(); ++stIndex) + size_t stCountOfAssignments = 0; + size_t stIDColumnIndex = m_rColumns.GetColumnIndex(_T("id")); + size_t stCount = m_rColumns.GetCount(); + for(size_t stIndex = 0; stIndex < stCount; ++stIndex) { - if(m_vValues[stIndex].which() != 0) // not for eNull values (0th element of variant) + if(stIndex != stIDColumnIndex && HasData(stIndex)) { strQuery += boost::str(boost::wformat(_T("%1%=?,")) % m_rColumns.GetColumnName(stIndex)).c_str(); + ++stCountOfAssignments; } } + if(stCountOfAssignments == 0) + return TString(); + strQuery.TrimRightSelf(_T(",")); strQuery += _T(" WHERE id=?"); @@ -391,24 +331,212 @@ return TString(); } -TRowID TSQLiteSerializerRowData::GetChangeIdentification() const +unsigned long long TSQLiteSerializerRowData::GetChangeIdentification() const { - TRowID rowID(m_rColumns); - rowID.SetAddedBit(m_bAdded); - for(size_t stIndex = 0; stIndex < m_vValues.size(); ++stIndex) + return GetDataHeader(); +} + +void TSQLiteSerializerRowData::MarkAsAdded() +{ + // first bit is always the "added" bit + m_pPoolMemory[0] |= AddedBit; +} + +const unsigned long long& TSQLiteSerializerRowData::GetDataForColumn(size_t stColIndex) const +{ + return (m_pPoolMemory[stColIndex + 1]); +} + +unsigned long long& TSQLiteSerializerRowData::ModifyColumnData(size_t stColIndex) +{ + FreeColumnData(stColIndex); + + MarkColumnUsage(stColIndex, true); + return (m_pPoolMemory[stColIndex + 1]); +} + +void TSQLiteSerializerRowData::MarkColumnUsage(size_t stIndex, bool bUsed) +{ + if(stIndex >= m_rColumns.GetCount()) + THROW_SERIALIZER_EXCEPTION(eErr_BoundsExceeded, _T("Wrong column provided")); + + unsigned long long ullMask = 2 << stIndex; + if(bUsed) + m_pPoolMemory[0] |= ullMask; + else + m_pPoolMemory[0] &= ~ullMask; +} + +bool TSQLiteSerializerRowData::IsAdded() const +{ + return (m_pPoolMemory[0] & AddedBit) != 0; +} + +bool TSQLiteSerializerRowData::HasAnyData() const +{ + return GetDataHeader() != 0; +} + +bool TSQLiteSerializerRowData::HasData(size_t stColumnIndex) const +{ + return (GetDataHeader() & (2 << stColumnIndex)) != 0; +} + +void TSQLiteSerializerRowData::BindParams(sqlite::TSQLiteStatement &tStatement, int& iSQLiteColumnNumber, size_t stSkipColumn) +{ + size_t stCount = m_rColumns.GetCount(); + for(size_t stColumn = 0; stColumn < stCount; ++stColumn) { - if(m_vValues[stIndex].which() != 0) + if(stColumn == stSkipColumn) + continue; + + if(HasData(stColumn)) { - rowID.SetColumnBit(stIndex, true); + switch(m_rColumns.GetColumnType(stColumn)) + { + case IColumnsDefinition::eType_bool: + { + bool bValue = GetDataForColumn(stColumn) != 0 ? true : false; + DBTRACE1_D(_T("- param(bool): %ld\n"), bValue ? 1l : 0l); + tStatement.BindValue(iSQLiteColumnNumber++, bValue); + break; + } + + case IColumnsDefinition::eType_short: + { + short siValue = *(short*)(unsigned short*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(short): %d\n"), siValue); + tStatement.BindValue(iSQLiteColumnNumber++, siValue); + break; + } + + case IColumnsDefinition::eType_ushort: + { + unsigned short usiValue = (unsigned short)GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(ushort): %u\n"), usiValue); + tStatement.BindValue(iSQLiteColumnNumber++, usiValue); + break; + } + + case IColumnsDefinition::eType_int: + { + int iValue = *(int*)(unsigned int*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(int): %ld\n"), iValue); + tStatement.BindValue(iSQLiteColumnNumber++, iValue); + break; + } + + case IColumnsDefinition::eType_uint: + { + unsigned int uiValue = (unsigned int)GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(uint): %lu\n"), uiValue); + tStatement.BindValue(iSQLiteColumnNumber++, uiValue); + break; + } + + case IColumnsDefinition::eType_long: + { + long lValue = *(long*)(unsigned long*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(long): %ld\n"), lValue); + tStatement.BindValue(iSQLiteColumnNumber++, lValue); + break; + } + + case IColumnsDefinition::eType_ulong: + { + unsigned long ulValue = (unsigned long)GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(ulong): %lu\n"), ulValue); + tStatement.BindValue(iSQLiteColumnNumber++, ulValue); + break; + } + + case IColumnsDefinition::eType_longlong: + { + long long llValue = *(long long*)(unsigned long long*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(llong): %I64d\n"), llValue); + tStatement.BindValue(iSQLiteColumnNumber++, llValue); + break; + } + + case IColumnsDefinition::eType_ulonglong: + { + unsigned long long ullValue = GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(ullong): %I64u\n"), ullValue); + tStatement.BindValue(iSQLiteColumnNumber++, ullValue); + break; + } + + case IColumnsDefinition::eType_double: + { + double dValue = *(double*)(unsigned long long*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(double): %f\n"), dValue); + tStatement.BindValue(iSQLiteColumnNumber++, dValue); + break; + } + + case IColumnsDefinition::eType_string: + { + const wchar_t* pszValue = (const wchar_t*)(unsigned long long*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(string): %s\n"), pszValue); + tStatement.BindValue(iSQLiteColumnNumber++, pszValue); + break; + } + + case IColumnsDefinition::eType_path: + { + const wchar_t* pszValue = (const wchar_t*)(unsigned long long*)&GetDataForColumn(stColumn); + DBTRACE1_D(_T("- param(path): %s\n"), pszValue); + tStatement.BindValue(iSQLiteColumnNumber++, PathFromString(pszValue)); + break; + } + + default: + THROW_SERIALIZER_EXCEPTION(eErr_InvalidArgument, _T("Invalid type")); + } } } +} - return rowID; +unsigned long long TSQLiteSerializerRowData::GetDataHeader() const +{ + return m_pPoolMemory[0]; } -void TSQLiteSerializerRowData::MarkAsAdded() +void TSQLiteSerializerRowData::FreeColumnData(size_t stColumnID) { - m_bAdded = true; + if(!HasData(stColumnID)) + return; + + switch(m_rColumns.GetColumnType(stColumnID)) + { + case IColumnsDefinition::eType_path: + case IColumnsDefinition::eType_string: + { + unsigned long long& ullColumnData = m_pPoolMemory[stColumnID + 1]; + wchar_t* pszData = (wchar_t*)ullColumnData; + delete [] pszData; + + ullColumnData = 0ULL; + + break; + } + } } +void TSQLiteSerializerRowData::FreeAllColumnData() +{ + size_t stCount = m_rColumns.GetCount(); + for(size_t stColumn = 0; stColumn < stCount; ++stColumn) + { + FreeColumnData(stColumn); + } +} + +TSQLiteSerializerRowData& TSQLiteSerializerRowData::operator=(const TSQLiteSerializerRowData& rSrc) +{ + m_pPoolMemory = rSrc.m_pPoolMemory; + + return *this; +} + END_CHCORE_NAMESPACE Index: src/libchcore/TSQLiteSerializerRowData.h =================================================================== diff -u -r3933d378c75e0b245a6ccb91099eaeb2c5728209 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision 3933d378c75e0b245a6ccb91099eaeb2c5728209) +++ src/libchcore/TSQLiteSerializerRowData.h (.../TSQLiteSerializerRowData.h) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -31,61 +31,20 @@ BEGIN_CHCORE_NAMESPACE -class LIBCHCORE_API TRowID -{ -public: - TRowID(const TSQLiteColumnsDefinition& rColumnDefinition); - ~TRowID(); - - void Clear(); - - void SetAddedBit(bool bAdded); - void SetColumnBit(size_t stIndex, bool bColumnExists); - - bool HasAny() const; - - bool operator==(const TRowID rSrc) const; - bool operator<(const TRowID rSrc) const; - -private: -#pragma warning(push) -#pragma warning(disable: 4251) - boost::dynamic_bitset<> m_bitset; -#pragma warning(pop) -}; - class LIBCHCORE_API TSQLiteSerializerRowData : public ISerializerRowData { private: - enum ENullType - { - eNull - }; + static const unsigned long long AddedBit = 1; - typedef boost::variant< - ENullType, - bool, - short, - unsigned short, - int, - unsigned int, - long, - unsigned long, - long long, - unsigned long long, - double, - TString, - TSmartPath - > InternalVariant; - private: - TSQLiteSerializerRowData& operator=(const TSQLiteSerializerRowData& rSrc); + TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded, unsigned long long* pPoolMemory, size_t stPoolMemorySizeInBytes); public: - TSQLiteSerializerRowData(size_t stRowID, TSQLiteColumnsDefinition& rColumnDefinition, bool bAdded); TSQLiteSerializerRowData(const TSQLiteSerializerRowData& rSrc); virtual ~TSQLiteSerializerRowData(); + TSQLiteSerializerRowData& operator=(const TSQLiteSerializerRowData& rSrc); + virtual ISerializerRowData& SetValue(size_t stColIndex, bool bValue); virtual ISerializerRowData& SetValue(size_t stColIndex, short iValue); virtual ISerializerRowData& SetValue(size_t stColIndex, unsigned short uiValue); @@ -113,25 +72,32 @@ virtual ISerializerRowData& SetValue(const TString& strColumnName, const TSmartPath& pathValue); TString GetQuery(const TString& strContainerName) const; - TRowID GetChangeIdentification() const; + unsigned long long GetChangeIdentification() const; void BindParamsAndExec(sqlite::TSQLiteStatement& tStatement); +private: + const unsigned long long& GetDataForColumn(size_t stColIndex) const; + unsigned long long GetDataHeader() const; + unsigned long long& ModifyColumnData(size_t stColIndex); + void FreeColumnData(size_t stColumnID); + void FreeAllColumnData(); + void MarkAsAdded(); + bool IsAdded() const; -private: - ISerializerRowData& SetValue(size_t stColIndex, const InternalVariant& rData); + bool HasAnyData() const; + void MarkColumnUsage(size_t stIndex, bool bUsed); + bool HasData(size_t stColumnIndex) const; + void BindParams(sqlite::TSQLiteStatement &tStatement, int& iSQLiteColumnNumber, size_t bSkipColumn = (size_t)-1); + private: - size_t m_stRowID; - bool m_bAdded; -#pragma warning(push) -#pragma warning(disable: 4251) + unsigned long long* m_pPoolMemory; + TSQLiteColumnsDefinition& m_rColumns; - typedef std::vector VecVariants; // column id -> variant data - VecVariants m_vValues; -#pragma warning(pop) + friend class TSQLiteSerializerContainer; }; typedef boost::shared_ptr TSQLiteSerializerRowDataPtr; Index: src/libchcore/TSubTaskArray.cpp =================================================================== diff -u -r3933d378c75e0b245a6ccb91099eaeb2c5728209 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision 3933d378c75e0b245a6ccb91099eaeb2c5728209) +++ src/libchcore/TSubTaskArray.cpp (.../TSubTaskArray.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -331,7 +331,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_long); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("type"), IColumnsDefinition::eType_int); rColumns.AddColumn(_T("is_current"), IColumnsDefinition::eType_bool); rColumns.AddColumn(_T("is_estimation"), IColumnsDefinition::eType_bool); @@ -345,7 +345,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_long); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("operation"), IColumnsDefinition::eType_int); } Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -124,7 +124,8 @@ void TCopyMoveProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("cf_processed_size"), IColumnsDefinition::eType_ulonglong); } Index: src/libchcore/TSubTaskDelete.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskDelete.cpp (.../TSubTaskDelete.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -89,7 +89,8 @@ void TDeleteProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); } void TDeleteProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) Index: src/libchcore/TSubTaskFastMove.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskFastMove.cpp (.../TSubTaskFastMove.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -91,7 +91,8 @@ void TFastMoveProgressInfo::InitColumns(IColumnsDefinition& rColumns) { - rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_sizet); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); + rColumns.AddColumn(_T("current_index"), IColumnsDefinition::eType_ulonglong); } void TFastMoveProgressInfo::Load(const ISerializerRowReaderPtr& spRowReader) Index: src/libchcore/TSubTaskStatsInfo.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TSubTaskStatsInfo.cpp (.../TSubTaskStatsInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -327,8 +327,8 @@ rColumnDefs.AddColumn(_T("total_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("processed_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("size_speed"), IColumnsDefinition::eType_string); - rColumnDefs.AddColumn(_T("total_count"), IColumnsDefinition::eType_sizet); - rColumnDefs.AddColumn(_T("processed_count"), IColumnsDefinition::eType_sizet); + rColumnDefs.AddColumn(_T("total_count"), IColumnsDefinition::eType_ulonglong); + rColumnDefs.AddColumn(_T("processed_count"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("count_speed"), IColumnsDefinition::eType_string); rColumnDefs.AddColumn(_T("ci_processed_size"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("ci_total_size"), IColumnsDefinition::eType_ulonglong); Index: src/libchcore/TTaskBaseData.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TTaskBaseData.cpp (.../TTaskBaseData.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -130,8 +130,9 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("name"), IColumnsDefinition::eType_string); - rColumns.AddColumn(_T("log_path"), IColumnsDefinition::eType_string); + rColumns.AddColumn(_T("log_path"), IColumnsDefinition::eType_path); rColumns.AddColumn(_T("current_state"), IColumnsDefinition::eType_int); rColumns.AddColumn(_T("destination_path"), IColumnsDefinition::eType_path); } Index: src/libchcore/TTaskInfo.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TTaskInfo.cpp (.../TTaskInfo.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -98,7 +98,7 @@ void TTaskInfoEntry::InitColumns(IColumnsDefinition& rColumnDefs) { - rColumnDefs.AddColumn(_T("id"), IColumnsDefinition::eType_sizet); + rColumnDefs.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumnDefs.AddColumn(_T("path"), IColumnsDefinition::eType_path); rColumnDefs.AddColumn(_T("task_order"), IColumnsDefinition::eType_int); } Index: src/libchcore/TTaskLocalStats.cpp =================================================================== diff -u -ra3d1e4c03280ece94af75d9aef32a65266cf8050 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision a3d1e4c03280ece94af75d9aef32a65266cf8050) +++ src/libchcore/TTaskLocalStats.cpp (.../TTaskLocalStats.cpp) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -189,7 +189,7 @@ IColumnsDefinition& rColumns = spContainer->GetColumnsDefinition(); if(rColumns.IsEmpty()) { - rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_long); + rColumns.AddColumn(_T("id"), IColumnsDefinition::eType_ulonglong); rColumns.AddColumn(_T("elapsed_time"), IColumnsDefinition::eType_ulonglong); } } Index: src/libchcore/libchcore.vc120.vcxproj =================================================================== diff -u -rb712554e2b3602ce7242c7ff1cd7745b03378440 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/libchcore.vc120.vcxproj (.../libchcore.vc120.vcxproj) (revision b712554e2b3602ce7242c7ff1cd7745b03378440) +++ src/libchcore/libchcore.vc120.vcxproj (.../libchcore.vc120.vcxproj) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -528,7 +528,6 @@ - @@ -677,7 +676,6 @@ - Index: src/libchcore/libchcore.vc120.vcxproj.filters =================================================================== diff -u -rb712554e2b3602ce7242c7ff1cd7745b03378440 -rffdee64cb0f2d472bb4102abe80ee12783e794c8 --- src/libchcore/libchcore.vc120.vcxproj.filters (.../libchcore.vc120.vcxproj.filters) (revision b712554e2b3602ce7242c7ff1cd7745b03378440) +++ src/libchcore/libchcore.vc120.vcxproj.filters (.../libchcore.vc120.vcxproj.filters) (revision ffdee64cb0f2d472bb4102abe80ee12783e794c8) @@ -194,9 +194,6 @@ Source Files\Serialization\SQLite\SQLite Schemas - - Source Files\Serialization\SQLite - Source Files\Serialization\SQLite @@ -448,9 +445,6 @@ Source Files\Serialization\SQLite\SQLite Schemas - - Source Files\Serialization\SQLite - Source Files\Serialization\SQLite