예제 #1
0
void ProgSettings::openSettingConnection()
{
    DlgSettingConnect *dlg = new DlgSettingConnect(QApplication::activeWindow());

    dlg->SetDBType(DBType());
    dlg->SetDBName(DBName());
    dlg->SetDBHostName(DBHostName());
    dlg->SetDBUserName(DBUserName());
    dlg->SetDBPassword(DBPassword());
    dlg->SetDBPort(DBPort());

    if ((dlg->exec() == QDialog::Accepted) && (dlg->IsModified()))
    {
        SetDBType(dlg->DBType());
        SetDBName(dlg->DBName());
        SetDBHostName(dlg->DBHostName());
        SetDBUserName(dlg->DBUserName());
        SetDBPassword(dlg->DBPassword());
        SetDBPort(dlg->DBPort());

        if (QSqlDatabase::database().isValid() & QSqlDatabase::database().isOpen())
        {
            QSqlDatabase::database().close();
            QSqlDatabase::removeDatabase(QSqlDatabase::database().connectionName());
        }
    }
}
예제 #2
0
extern void
CommandRelationalSetup(char *sz)
{
    char *apch[2];

    if (ParseKeyValue(&sz, apch)) {
        if (!StrCaseCmp(apch[0], "dbtype"))
            SetDBType(apch[1]);
        if (!StrCaseCmp(apch[0], "storegamestats"))
            storeGameStats = !StrCaseCmp(apch[1], "yes");
        else {
            char *pc = apch[0];
            char *db = NextTokenGeneral(&pc, "-");
            SetDBParam(db, pc, apch[1]);
        }
    }
}