#pragma once #include "base/define.h" #include "base/error.h" #include #include #define SQLITE_RESULT std::vector> namespace ylib { class sqlite3:public ylib::error_base { public: sqlite3(); ~sqlite3(); bool open(const std::string& filepath,const std::string& username ="",const std::string& password = ""); void close(); bool exec(const std::string& sql); bool query(const std::string& sql, std::vector>& data); int64 count(const std::string& sql); bool is_open() { return m_db != nullptr; } int64 last_insert_id(); private: void* m_db; }; }