为数据库插入增加保护
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user