static void TRANSACTION_ChangeState ( unsigned long txHigh, unsigned long txLow, CString& strOperation, CTypedPtrList < CObList, CaTableTransactionItemData* >& ls) { unsigned long lLow, lHigh; CaTableTransactionItemData* pObj = NULL; POSITION pos = ls.GetHeadPosition(); while (pos != NULL) { pObj = ls.GetNext (pos); pObj->GetTransactionID (lHigh, lLow); if (txHigh == lHigh && txLow == lLow) { if (strOperation.CompareNoCase (_T("COMMIT")) == 0) { pObj->SetCommit (TRUE); pObj->SetJournal (TRUE); } else if (strOperation.CompareNoCase (_T("ABORT")) == 0) { pObj->SetCommit (FALSE); pObj->SetJournal (TRUE); } else if (strOperation.CompareNoCase (_T("COMMITNJ")) == 0) { pObj->SetCommit (TRUE); pObj->SetJournal (FALSE); } else if (strOperation.CompareNoCase (_T("ABORTNJ")) == 0) { pObj->SetCommit (FALSE); pObj->SetJournal (FALSE); } else { // // String in OPERATION in not in ('commit', 'abort', 'commitnj', 'abortnj') ASSERT (FALSE); } } } }
static CaTableTransactionItemData* TRANSACTION_Find ( unsigned long txHigh, unsigned long txLow, CTypedPtrList < CObList, CaTableTransactionItemData* >& ls) { unsigned long lLow, lHigh; CaTableTransactionItemData* pObj = NULL; POSITION pos = ls.GetHeadPosition(); while (pos != NULL) { pObj = ls.GetNext (pos); pObj->GetTransactionID (lHigh, lLow); if (txHigh == lHigh && txLow == lLow) return pObj; } return NULL; }
void CuDlgIjaTable::GetSelectedTransactions (CTypedPtrList < CObList, CaBaseTransactionItemData* >& ltr) { int i, nCount; int nFound = -1; CaTableTransactionItemData* pItemTable= NULL; CString strTable; CString strTableOwner; CString strData; m_queryTransactionInfo.GetTable (strTable, strTableOwner); nCount = m_cListCtrl.GetItemCount(); for (i=0; i<nCount; i++) { if (m_cListCtrl.GetItemState (i, LVIS_SELECTED) & LVIS_SELECTED) { pItemTable = (CaTableTransactionItemData*)m_cListCtrl.GetItemData (i); if (!pItemTable) continue; unsigned long ltr1L, ltr1H; unsigned long ltr2L, ltr2H; for (int j=0; j<nCount; j++) { CaTableTransactionItemData* pItem = (CaTableTransactionItemData*)m_cListCtrl.GetItemData(j); if (!pItem) continue; pItem->GetTransactionID(ltr1H, ltr1L); pItemTable->GetTransactionID(ltr2H, ltr2L); if (ltr1H == ltr2H && ltr1L == ltr2L) { pItem->SetTable (strTable); pItem->SetTableOwner (strTableOwner); if (ltr.Find(pItem) == NULL) ltr.AddTail (pItem); } } } } }