void CDbTableDatabase::CAlterTable::ConstructL(const CDbColSet& aNewDef,TInt& aStep) // // get all the deleted columns // check changes to columns still present // get all the new columns // construct a new columns set based on the changes // { // // flag all columns as dropped initially HDbColumnSet& columns=iDef.Columns(); HDbColumnSet::TIterator iter=columns.Begin(); HDbColumnSet::TIteratorC const end=columns.End(); do { iter->iFlags=TDbColumnDef::EDropped; } while (++iter<end); // // look for additions and changes CDbColSet* change=CDbColSet::NewLC(); CDbColSet* add=CDbColSet::NewLC(); for (TDbColSetIter iterNew(aNewDef);iterNew;++iterNew) { const TDbCol& col=*iterNew; TDbColumnDef* def=columns.ColumnL(iterNew->iName); if (!def) // a new column add->AddL(col); else { // see if the definition has changed if (def->iAttributes!=col.iAttributes) __LEAVE(KErrArgument); // can't change attributes TUint8 flag=0; if (def->iType!=col.iType) flag=TDbColumnDef::EChangedType; else if (def->iType>=EDbColText8 && col.iMaxLength!=KDbUndefinedLength && col.iMaxLength!=def->iMaxLength) flag=TDbColumnDef::EChangedLen; def->iFlags=flag; if (flag) change->AddL(col); // column has changed } } // // check that all marked columns are not indexed // iter=columns.Begin(); do { if (iter->iFlags && iDef.IsIndexed(*iter->iName)) __LEAVE(KErrArgument); // can't remove indexed column } while (++iter<end); // iNewSet=HDbColumnSet::NewL(aNewDef.Count()); iDef.AlteredColumnSetL(*iNewSet,*change,*add); CleanupStack::PopAndDestroy(2); // add, change Construct(Database().TableAlterL(iDef,*iNewSet,aStep)); }
bool OnTryLogon (void) { TList<TRef<LANServerInfo> > listResults; // try ten times int iTryCount = 10; while (iTryCount-- && (listResults.GetCount () == 0)) { // initiate a query for the local server trekClient.FindStandaloneServersByName ("127.0.0.1", listResults); //Imago REVIEW this hardly works now-a-days 6/10 // now, for 6 seconds, check to see if we found it every half second for (int i = 0; (i < 12) && (listResults.GetCount () == 0); i++) { Sleep (500); trekClient.FindStandaloneServersByName (NULL, listResults); } } // if we found a server... if (listResults.GetCount () == 1) { // there should be only one game on the server TList<TRef<LANServerInfo> >::Iterator iterNew(listResults); if (iterNew.Value ()->strGameName == TRAINING_MISSION_7_GAME_NAME) { // set ourselves to not be in the lobby or the zone trekClient.SetIsLobbied(false); trekClient.SetIsZoneClub(false); // set up the connection info BaseClient::ConnectInfo ci; ci.guidSession = iterNew.Value ()->guidSession; strcpy (ci.szName, "Cadet"); // we try five times iTryCount = 5; while (iTryCount-- && !trekClient.m_fm.IsConnected ()) { // close any popups while (!GetWindow()->GetPopupContainer()->IsEmpty()) GetWindow()->GetPopupContainer()->ClosePopup(NULL); GetWindow()->RestoreCursor(); // connect to the server trekClient.ConnectToServer (ci, NA, Time::Now(), "", true); } } } // if we didn't get connected if (!trekClient.m_fm.IsConnected ()) { // close any popups while (!GetWindow()->GetPopupContainer()->IsEmpty()) GetWindow()->GetPopupContainer()->ClosePopup(NULL); GetWindow()->RestoreCursor(); // give some indication of what happened TRef<IMessageBox> pmsgBox = CreateMessageBox("Connection to standalone server failed."); GetWindow()->GetPopupContainer()->OpenPopup(pmsgBox, false); // terminate the game so they can try again KillStandaloneGame (); // report the number of servers found as a diagnostic #ifdef _DEBUG char szBuffer[256]; sprintf (szBuffer, "Found %d servers.\n", listResults.GetCount ()); debugf (szBuffer); #endif } else { // tell training that this is the live mission Training::StartMission (Training::c_TM_7_Live); } return false; }