-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabaseconnection.cpp
More file actions
27 lines (20 loc) · 857 Bytes
/
databaseconnection.cpp
File metadata and controls
27 lines (20 loc) · 857 Bytes
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
#include "databaseconnection.h"
DatabaseConnection::DatabaseConnection(QWidget *parent) : QMainWindow(parent)
{
}
/*****************************************************************************************************
* Creating the database connection with a reference to the particular connection, connectionName.
* connectionName must be unique between classes.
******************************************************************************************************/
QSqlDatabase DatabaseConnection::establishConnection(QString connectionName){
db = QSqlDatabase::addDatabase("QMYSQL", connectionName);
db.setHostName("");
db.setUserName("ediCEO370");
db.setPassword("miguelCEO370");
db.setDatabaseName("EDI");
return db;
}
void DatabaseConnection::destroyDbConnection(){
db.close();
db.removeDatabase("QMYSQL");
}