优化了web界面,下载功能等
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include <ctime>
|
||||
#include <json/json.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
SQLiteDB::SQLiteDB(const std::string& dbPath) {
|
||||
if (sqlite3_open(dbPath.c_str(), &m_db) != SQLITE_OK) {
|
||||
@@ -674,6 +675,20 @@ string SQLiteDB::getDBPatch(){
|
||||
return m_dbPath;
|
||||
}
|
||||
|
||||
long SQLiteDB::getDatabaseSize() {
|
||||
if (m_dbPath.empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct stat stat_buf;
|
||||
int rc = stat(m_dbPath.c_str(), &stat_buf);
|
||||
if (rc != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return stat_buf.st_size;
|
||||
}
|
||||
|
||||
bool SQLiteDB::clearPowerData() {
|
||||
if (!m_db) return false;
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ public:
|
||||
|
||||
// 获取数据库状态函数
|
||||
string getDBPatch();
|
||||
|
||||
// 获取数据库大小
|
||||
long getDatabaseSize();
|
||||
|
||||
private:
|
||||
sqlite3* m_db;
|
||||
|
||||
Reference in New Issue
Block a user