为数据库插入增加保护

This commit is contained in:
zjk
2026-01-19 21:52:26 +08:00
parent 481171d9ea
commit b5ca051831
97 changed files with 363231 additions and 98 deletions
+9 -1
View File
@@ -2,17 +2,25 @@
#define SQLITE_H
#include "sqlite3.h"
#include <string>
#include <mutex>
#include "../pmSysvariable.h"
class SQLite
{
private:
sqlite3* m_db;
std::mutex m_dbMutex;
bool checkConnection();
public:
std::string m_dbPath;
SQLite(const std::string& dbName);
~SQLite();
// 检查数据库连接是否有效
bool isConnected() const { return m_db != nullptr; }
//创建表
bool createTable();
bool createTable(const std::string& tableName, const std::string& columns);
@@ -33,4 +41,4 @@ public:
};
#endif
#endif // SQLITE_H