sqlite_server/inc/litedb.h

36 lines
648 B
C
Raw Normal View History

2025-03-13 20:26:17 +08:00
#pragma once
#include <string>
#include <status.h>
#include <sqlite3.h>
class litedb
{
private:
std::string _db_path_name;
sqlite3 *db;
sqlite3_stmt *stmt;
litedb(const litedb &oth) = delete;
litedb &operator=(const litedb &oth) = delete;
const static std::string SQL_TEXT_FETCH_ALL_TABLE_NAME;
public:
litedb(std::string &db_name);
Status litedb_open();
inline bool is_db_open() const
{
return this->db ? true : false;
}
~litedb();
};
const std::string litedb::SQL_TEXT_FETCH_ALL_TABLE_NAME =
"SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';";