123456789101112131415161718192021222324252627282930313233 |
- #pragma once
- #pragma comment(lib,"libmysql")
- #include <mysql.h>
- typedef struct DatabaseInformation //数据库信息
- {
- const char* server_address;///服务器地址
- const char* user_name;//数据管理员
- const char* password;//管理员密码
- const char* database_name;//数据库名称
- int server_port;//端口
- }DBINFO;
- class HtlMysql
- {
- private:
- //PreparedStatement* pstmt;
- MYSQL* p_sql = NULL;
- HtlMysql();
- MYSQL_RES* p_res = NULL;
- //PreparedStatement* pstmt;
- public:
-
- MYSQL_ROW row;
- static HtlMysql* GetInstance();
- //连接数据库
- bool Connect(DBINFO& Dbinfo);//连接数据库
- const char* GetErrorInformation();//获取错误信息
- bool ExecutiveCommand(const char* SQLCommand);//执行命令
- MYSQL_RES* GetResultSet();//获取结果集
- ~HtlMysql();
- };
|