forked from CodingMorry7/Get2gether
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconnection.cpp
41 lines (32 loc) · 1.25 KB
/
connection.cpp
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
#include "connection.h"
/*=================================================================================================================================*/
// class Connection-Specific Methods
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Constructor |*/
/*'------------------------'*/
// PURPOSE: default constructor
connection::connection()
{
}
/*=================================================================================================================================*/
/*.------------------------.*/
/*| Open Connection |*/
/*'------------------------'*/
// PURPOSE: opens connection to database
void connection::openConn() {
db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("35.203.187.201");
db.setPort(3306);
db.setUserName("root");
db.setPassword("get2gether");
db.open();
}
/*.------------------------.*/
/*| Close Connection |*/
/*'------------------------'*/
// PURPOSE: closes current connection to database
void connection::closeConn() {
db.close();
db.removeDatabase("QMYSQL");
}