BOOL CtrfFolderColumn::RefreshData(CTreeCtrl* pTree, HTREEITEM hItem, CaRefreshTreeInfo* pInfo) { BOOL bOk = FALSE; CTypedPtrList< CObList, CaDBObject* > lNew; // // Refresh only the branch has already been expanded: if (pInfo && pInfo->GetAction() == CaRefreshTreeInfo::ACTION_REFRESH && !GetTreeCtrlData().IsAlreadyExpanded()) return TRUE; CaLLQueryInfo* pQueryInfo = GetQueryInfo(NULL); ASSERT (pQueryInfo); if (!pQueryInfo) return FALSE; if (GetPfnCOMQueryObject()) bOk = GetPfnCOMQueryObject()(GetAptAccess(), pQueryInfo, lNew); else { CmtSessionManager* pSessionManager = GetSessionManager(); ASSERT (pSessionManager); if (!pSessionManager) return FALSE; if (GetPfnUserQueryObject()) bOk = GetPfnUserQueryObject()(pQueryInfo, lNew, pSessionManager); else bOk = INGRESII_llQueryObject (pQueryInfo, lNew, pSessionManager); } if (!bOk) return FALSE; // // Mark all old object as being deleted: CtrfItemData* pObj = NULL; POSITION p = NULL, pos = m_listObject.GetHeadPosition(); while (pos != NULL) { pObj = m_listObject.GetNext (pos); pObj->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_DELETE); } // // Add new Objects: while (!lNew.IsEmpty()) { CaColumn* pNew = (CaColumn*)lNew.RemoveHead(); CtrfItemData* pExist = SearchObject(pNew); // // The new queried object already exists in the old list, we destroy it ! if (pExist != NULL) { pExist->GetTreeCtrlData().SetState (CaTreeCtrlData::ITEM_EXIST); delete pNew; continue; } // // New object that is not in the old list, add it to the list: CtrfColumn* pNewObject = new CtrfColumn (pNew); pNewObject->SetBackParent (this); pNewObject->Initialize(); m_listObject.AddTail (pNewObject); delete pNew; } // // Refresh Sub-Branches ? Display (pTree, hItem); return TRUE; }
// // This function should call the query objects from the Static library ("INGRESII_llQueryObject") or // from the COM Server ICAS. BOOL CSqlqueryApp::INGRESII_QueryObject(CaLLQueryInfo* pInfo, CTypedPtrList<CObList, CaDBObject*>& listObject) { CaSessionManager& ssMgr = GetSessionManager(); BOOL bOk = INGRESII_llQueryObject (pInfo, listObject, &ssMgr); return bOk; }