From 6703c96aa242966e17757c057906289715bd3ab9 Mon Sep 17 00:00:00 2001 From: lzx <2246256235@qq.com> Date: 星期四, 07 十一月 2024 15:06:49 +0800 Subject: [PATCH] 日志提交 --- Server/王琨元/code/MysqlConn.h | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h" "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h" index 577bb2c..53bb3fc 100644 --- "a/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h" +++ "b/Server/\347\216\213\347\220\250\345\205\203/code/MysqlConn.h" @@ -2,37 +2,40 @@ #include <string> #include <WinSock2.h> -#include <mysql.h> +//#include <mysql.h> +#include "MySQL/include/mysql.h" #include <string.h> #include <chrono> + +#pragma comment(lib,"./MySQL/lib/libmysql.lib") class MysqlConn { public: - // 初始化连接 + // 锟斤拷始锟斤拷锟斤拷锟斤拷 MysqlConn(); - // 连接数据库 + // 锟斤拷锟斤拷锟斤拷锟捷匡拷 bool connect(std::string ip, std::string userName, std::string passwd, std::string db , int port = 3306); - // 释放资源 + // 锟酵凤拷锟斤拷源 ~MysqlConn( ); - // 更新数据库 ( insert update delete ) + // 锟斤拷锟斤拷锟斤拷锟捷匡拷 ( insert update delete ) bool update(std::string sql); - // 查询数据库 + // 锟斤拷询锟斤拷锟捷匡拷 bool query(std::string sql); - // 得到结果集 + // 锟矫碉拷锟斤拷锟斤拷锟斤拷 bool getResult(); - // 获取结果集的字段 + // 锟斤拷取锟斤拷锟斤拷锟斤拷锟斤拷锟街讹拷 std::string getField(int index); - // 事务操作 + // 锟斤拷锟斤拷锟斤拷锟斤拷 bool transaction(); - // 提交事务 + // 锟结交锟斤拷锟斤拷 bool commit( ); - // 事务回滚 + // 锟斤拷锟斤拷锟截癸拷 bool rollback(); - void refreshActiveTime( ); // 刷新活跃时间 - long long getActiveTime(); // 获取当前活跃的时间间隔 - // 安全校验接口 + void refreshActiveTime( ); // 刷锟铰伙拷跃时锟斤拷 + long long getActiveTime(); // 锟斤拷取锟斤拷前锟斤拷跃锟斤拷时锟斤拷锟斤拷锟斤拷 + // 锟斤拷全校锟斤拷锟接匡拷 bool isSqlSafe(const std::string& sql); private: -- Gitblit v1.8.0