WIP: remove the old database abstraction layer
remove such classes: - DbBase - DbConn - DbTextStream - Db while here: - remove: TextStream, SLog, TexTextStream
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010-2021, Tomasz Sowa
|
||||
* Copyright (c) 2010-2024, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -36,49 +36,36 @@
|
||||
#define headerfile_winix_plugins_thread_tdb
|
||||
|
||||
#include <vector>
|
||||
#include "core/winixmodeldeprecated.h"
|
||||
#include "thread.h"
|
||||
#include "db/dbbase.h"
|
||||
#include "threadfiles.h"
|
||||
#include "core/error.h"
|
||||
|
||||
namespace Winix
|
||||
|
||||
namespace Winix::Thread
|
||||
{
|
||||
|
||||
|
||||
namespace Thread
|
||||
{
|
||||
|
||||
|
||||
class TDb : public DbBase
|
||||
class TDb : public WinixModelDeprecated
|
||||
{
|
||||
public:
|
||||
|
||||
/*
|
||||
high level interface
|
||||
*/
|
||||
void GetAnswers(long file_id, std::vector<ThreadFiles> & answer_id_tab);
|
||||
bool AddAnswer(long file_id, long answer_id);
|
||||
|
||||
//Error AddThread(const Thread & thread);
|
||||
//Error GetThread(long file_id, Thread & thread);
|
||||
//Error GetThreads(const std::vector<long> & file_id_tab, std::vector<Thread> & thread_tab);
|
||||
Error RemoveThread(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
|
||||
*/
|
||||
bool RemoveAnswer(long answer_id);
|
||||
bool RemoveThread(long file_id);
|
||||
|
||||
// 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);
|
||||
// returning all threads
|
||||
// IMPROVEME need to be refactored
|
||||
void GetAllThreads(std::vector<Thread> & threads);
|
||||
|
||||
// removing only the answer in 'thread_files' table without updating 'thread' table
|
||||
Error RemoveAnswerOnly(long answer_id);
|
||||
bool RemoveAnswerOnly(long answer_id);
|
||||
|
||||
// returning how many answers there are
|
||||
// calculating from 'thread_files' table
|
||||
@@ -91,25 +78,20 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
DbTextStream query;
|
||||
std::wstring list_id;
|
||||
int cfile_id, creplies, cclosed;
|
||||
//int clast_item, cdate_modification, cuser_id, cguest;
|
||||
Thread thread_temp;
|
||||
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);
|
||||
bool do_query(pt::TextStream & query);
|
||||
|
||||
bool RemoveAnswerRecalcLast(long file_id);
|
||||
bool RemoveAnswerRecalcLast(const std::vector<long> & file_id_tab);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
} // namespace Winix
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user