void DbSettingDialog::DoSaveMySQLHistory() { clConfig config(DBE_CONFIG_FILE); DbExplorerSettings settings; config.ReadItem(&settings); DbConnectionInfoVec mysql = settings.GetMySQLConnections(); DbConnectionInfo conn; conn.SetConnectionType(DbConnectionInfo::DbConnTypeMySQL); conn.SetDefaultDatabase(wxT("")); conn.SetConnectionName(m_txName->GetValue()); conn.SetPassword(m_txPassword->GetValue()); conn.SetServer(m_txServer->GetValue()); conn.SetUsername(m_txUserName->GetValue()); if(!conn.IsValid()) return; // remove any connection with this name DbConnectionInfoVec::iterator iter = mysql.begin(); for(; iter != mysql.end(); ++iter) { if(iter->GetConnectionName() == conn.GetConnectionName()) { mysql.erase(iter); break; } } mysql.insert(mysql.begin(), conn); settings.SetMySQLConnections(mysql); config.WriteItem(&settings); }
DbConnectionInfoVec DbSettingDialog::DoLoadMySQLHistory() { clConfig config(DBE_CONFIG_FILE); DbExplorerSettings settings; config.ReadItem(&settings); return settings.GetMySQLConnections(); }