-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathConnectDB.h
56 lines (37 loc) · 1.13 KB
/
ConnectDB.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<mysql.h>
#include<iostream>
using namespace std;
#ifndef STUSYSTEMGUI_CONNECTDB_H
#define STUSYSTEMGUI_CONNECTDB_H
class ConnectDB {
private:
//Ö÷»úµØÖ·
const char* host = "127.0.0.1";
//Êý¾Ý¿âÓû§
const char* user = "root";
//Êý¾Ý¿âÃÜÂ룬Ìî×Ô¼ºµÄ
const char* pw = "meng2003";
//Êý¾Ý¿âÃû³Æ
const char* dbName = "stusystem";
//Êý¾Ý¿â¶Ë¿Ú£¬mysqlÊÇ3306
const int port = 3306;
//»ñÈ¡µ½µÄÊý¾Ý¿âÁ¬½Ó
MYSQL* con = NULL;
public:
const char* getHost() const;
void setHost(const char* host);
const char* getUser() const;
void setUser(const char* user);
const char* getPw() const;
void setPw(const char* pw);
const char* getDbName() const;
void setDbName(const char* dbName);
const int getPort() const;
MYSQL* getCon() const;
void setCon(MYSQL* con);
ConnectDB(const char* host, const char* user, const char* pw, const char* dbName, const int port);
//ºËÐĺ¯Êý£¬Á¬½ÓÊý¾Ý¿â
void connect();
//Îö¹¹º¯Êý
~ConnectDB();
};