fixed: thread plugin didn't correctly set the last item and replies (in 'thread' table)

when deleting an answer
added: ThreadInfo::Repair() method
       will be used by 'fsck' winix function       
added: plugins/groupitem 
       directory for a new plugin: 'groupitem'
       


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@725 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-03-23 17:54:53 +00:00
parent ba63c8c661
commit d68731fd55
15 changed files with 498 additions and 50 deletions

View File

@@ -26,14 +26,42 @@ class TDb : public DbBase
{
public:
/*
high level interface
*/
Error AddThread(const Thread & thread);
Error GetThreadByFileId(long file_id, Thread & thread);
Error GetThread(long file_id, Thread & thread);
Error GetThreads(const std::vector<long> & file_id_tab, std::vector<Thread> & thread_tab);
Error GetAnswers(long file_id, std::vector<long> & answer_id_tab);
Error EditThreadAddItem(long file_id, long answer_id);
Error EditThreadRemoveItem(long file_id);
Error RemoveThread(long file_id);
long FindLastItem(long file_id);
Error AddAnswer(long file_id, long answer_id);
Error GetAnswers(long file_id, std::vector<long> & answer_id_tab);
Error RemoveAnswer(long answer_id);
/*
low level interface
*/
// looking for the last answer in a thread (in 'thread_files' table)
// this is not the value from 'thread' table
long FindLastAnswer(long file_id);
// returning all threads id (file_id) (from 'thread' table)
void GetAllThreadsId(std::vector<long> & file_id);
// removing only the answer in 'thread_files' table without updating 'thread' table
Error RemoveAnswerOnly(long answer_id);
// returning how many answers there are
// calculating from 'thread_files' table
// this is not the value from 'thread' table
long CalcAnswers(long file_id);
// recalculating last_item, replies in 'thread' table on a given thread
Error RecalcThread(long file_id);
private:
@@ -43,9 +71,10 @@ private:
Thread thread_temp;
std::vector<long> file_id_tab;
void SetThreadColumns(PGresult * r);
void SetThread(PGresult * r, int col, Thread & thread);
Error EditThreadRecalcFiles(const std::vector<long> & file_id_tab);
void SetThreadColumns(PGresult * r);
void SetThread(PGresult * r, int col, Thread & thread);
Error RemoveAnswerRecalcLast(long file_id);
Error RemoveAnswerRecalcLast(const std::vector<long> & file_id_tab);
};