mirror of
https://github.com/quizhizhe/LiteLoaderBDS-1.16.40.git
synced 2025-06-01 11:43:41 +00:00
40 lines
939 B
C++
40 lines
939 B
C++
#pragma once
|
|
#include "../../Session.h"
|
|
|
|
struct MYSQL;
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class MySQLStmt;
|
|
|
|
class MySQLSession : public Session
|
|
{
|
|
|
|
MYSQL* conn = nullptr;
|
|
|
|
void setSSL(const ConnParams& params);
|
|
|
|
public:
|
|
MySQLSession();
|
|
MySQLSession(const ConnParams& params);
|
|
~MySQLSession();
|
|
void open(const ConnParams& params);
|
|
bool execute(const std::string& query);
|
|
bool relogin(const std::string& user, const std::string& password, const std::string& db = "");
|
|
Session& query(const std::string& query, std::function<bool(const Row&)> callback);
|
|
SharedPointer<Stmt> prepare(const std::string& query, bool autoExecute = false);
|
|
std::string getLastError() const;
|
|
uint64_t getAffectedRows() const;
|
|
uint64_t getLastInsertId() const;
|
|
void close();
|
|
bool isOpen();
|
|
DBType getType();
|
|
|
|
SharedPointer<Stmt> operator<<(const std::string& query);
|
|
|
|
friend class MySQLStmt;
|
|
|
|
};
|
|
|
|
} // namespace DB
|