added custom port support for database

This commit is contained in:
giomba 2020-12-11 21:54:13 +01:00
parent a0eeb84de2
commit 56bdf0bfc3
2 changed files with 4 additions and 2 deletions

View File

@ -11,8 +11,9 @@ In next sections, «component» must be replaced by the proper name of the compo
Create `~/.config/it.linux.golem/component.conf` with following content:
[database]
hostname=serverozzo.golem.linux.it
database=golem_gestionale
hostname=vupiuesse.andromeda.golem.linux.it
port=7004
database=gestionale
username=golem
password=guess

View File

@ -17,6 +17,7 @@ int main(int argc, char *argv[])
/* open database and attach query */
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); /* QMYSQL <-- database driver */
db.setHostName(settings.value("hostname").toString());
db.setPort(settings.value("port").toInt());
db.setDatabaseName(settings.value("database").toString());
db.setUserName(settings.value("username").toString());
db.setPassword(settings.value("password").toString());