30 lines
720 B
C++
30 lines
720 B
C++
#ifndef __DATABASE_H__
|
|
#define __DATABASE_H__
|
|
|
|
#include "Base/DataStructure.h"
|
|
#include <list>
|
|
#include <string>
|
|
|
|
typedef struct sqlite3 sqlite3;
|
|
|
|
namespace Older {
|
|
class Database {
|
|
public:
|
|
bool open(const std::string &path);
|
|
void upsertVisitRecord(const std::string &url, const std::string &visitorUuid, const std::string &userAgent,
|
|
int64_t viewTime);
|
|
VisitorStats visitorStats(const std::string &url);
|
|
|
|
std::list<VisitorStats> mostViewedUrls(int n);
|
|
std::list<VisitorStats> latestViewedUrls(int n);
|
|
SiteStats siteStats();
|
|
|
|
protected:
|
|
void createVisitAnalysisTable();
|
|
void initialize();
|
|
|
|
private:
|
|
sqlite3 *m_sqlite = nullptr;
|
|
};}
|
|
|
|
#endif // __DATABASE_H__
|