void ScriptContextTTD::GetLoadedSources(const JsUtil::BaseHashSet<Js::FunctionBody*, HeapAllocator>* onlyLiveTopLevelBodies, JsUtil::List<TTD::TopLevelFunctionInContextRelation, HeapAllocator>& topLevelScriptLoad, JsUtil::List<TTD::TopLevelFunctionInContextRelation, HeapAllocator>& topLevelNewFunction, JsUtil::List<TTD::TopLevelFunctionInContextRelation, HeapAllocator>& topLevelEval) { TTDAssert(topLevelScriptLoad.Count() == 0 && topLevelNewFunction.Count() == 0 && topLevelEval.Count() == 0, "Should be empty when you call this."); for(auto iter = this->m_ttdTopLevelScriptLoad.GetIterator(); iter.IsValid(); iter.MoveNext()) { Js::FunctionBody* body = TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); if(onlyLiveTopLevelBodies == nullptr || onlyLiveTopLevelBodies->Contains(body)) { topLevelScriptLoad.Add(iter.CurrentValue()); } } for(auto iter = this->m_ttdTopLevelNewFunction.GetIterator(); iter.IsValid(); iter.MoveNext()) { Js::FunctionBody* body = TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); if(onlyLiveTopLevelBodies == nullptr || onlyLiveTopLevelBodies->Contains(body)) { topLevelNewFunction.Add(iter.CurrentValue()); } } for(auto iter = this->m_ttdTopLevelEval.GetIterator(); iter.IsValid(); iter.MoveNext()) { Js::FunctionBody* body = TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); if(onlyLiveTopLevelBodies == nullptr || onlyLiveTopLevelBodies->Contains(body)) { topLevelEval.Add(iter.CurrentValue()); } } }
Js::FunctionBody* ScriptContextTTD::FindRootBodyByTopLevelCtr(uint32 bodyCtrId) const { for(auto iter = this->m_ttdTopLevelScriptLoad.GetIterator(); iter.IsValid(); iter.MoveNext()) { if(iter.CurrentValue().TopLevelBodyCtr == bodyCtrId) { return TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); } } for(auto iter = this->m_ttdTopLevelNewFunction.GetIterator(); iter.IsValid(); iter.MoveNext()) { if(iter.CurrentValue().TopLevelBodyCtr == bodyCtrId) { return TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); } } for(auto iter = this->m_ttdTopLevelEval.GetIterator(); iter.IsValid(); iter.MoveNext()) { if(iter.CurrentValue().TopLevelBodyCtr == bodyCtrId) { return TTD_COERCE_PTR_ID_TO_FUNCTIONBODY(iter.CurrentValue().ContextSpecificBodyPtrId); } } return nullptr; }
int GetDatosCliente(int id,int nCliente,char szImagen[],char szPag[]) { char szSql[300]; char szAux[100]; Tipo_XML *xml=NULL; int sts; sprintf(szSql,"select tag_imagen,pagina_servicio from clientes where codigo=%i",nCliente); if (!QueryDatabase(id,szSql)) goto close; xml=MoveNext(id,&sts); if (sts!=DATOS_OK) { printf("El codigo %i, no existe en la tabla de clientes\n\r",nCliente); return 0; } CloseDatabase(id); GetStrXML(xml,"TAG_IMAGEN",szAux,sizeof(szAux)); sprintf(szImagen,"%s",szAux); GetStrXML(xml,"PAGINA_SERVICIO",szAux,sizeof(szAux)); sprintf(szPag,"%s",szAux); CierraXML(xml); return 1; close: CloseDatabase(id); CierraXML(xml); return 0; }
//Sube el diccionario de campos a memoria.. int InicializaEstructuraCampos(int id) { char szSql[1024]; Tipo_XML *xml=NULL; int i,sts; char szAux[10]; for(i=0;i<LEN_CAMPOS;i++) stCampos[i].nValido=0; sprintf(szSql,"select * from campos"); if (!QueryDatabase(id,szSql)) goto fin; i=0; do { xml=MoveNext(id,&sts); if (sts!=DATOS_OK) break; GetStrXML(xml,"NOMBRE",stCampos[i].szNombre,sizeof(stCampos[i].szNombre)); GetIntXML(xml,"LARGO",&stCampos[i].nLen); GetStrXML(xml,"TIPO",stCampos[i].szTipo,sizeof(stCampos[i].szTipo)); stCampos[i].nValido=1; i++; }while(1); CloseDatabase(id); CierraXML(xml); return 1; fin: CloseDatabase(id); CierraXML(xml); return 0; }
bool OdbcCommand::Execute(const tstring & szSQL) { if (!Open()) return false; #ifdef USE_SQL_TRACE TRACE((szSQL + _T("\n")).c_str()); #endif if (!BindParameters()) return false; SQLRETURN result = SQLExecDirect(m_hStmt, (SQLTCHAR *)szSQL.c_str(), szSQL.length()); if (!(result == SQL_SUCCESS || result == SQL_SUCCESS_WITH_INFO || result == SQL_NO_DATA)) { if (m_odbcConnection != nullptr) m_szError = m_odbcConnection->ReportSQLError(SQL_HANDLE_STMT, m_hStmt, (TCHAR *)szSQL.c_str(), _T("Failed to execute statement.")); else m_szError = OdbcConnection::GetSQLError(SQL_HANDLE_STMT, m_hStmt); Close(); return false; } if (!MoveNext()) MoveNextSet(); return true; }
void CLryEDBQryDoc::OnCursorMove(UINT nID) { try { switch(nID) { case ID_RECORD_FIRST: MoveFirst(); break; case ID_RECORD_PREV: MovePrevious(); break; case ID_RECORD_NEXT: MoveNext(); break; case ID_RECORD_LAST: MoveLast(); break; default: break; } } catch(_com_error &e) { dump_com_error(e); } UpdateAllViews( NULL,1); }
void ThreadContextTTD::LoadInvertedRootMap(JsUtil::BaseDictionary<Js::RecyclableObject*, TTD_LOG_PTR_ID, HeapAllocator>& objToLogIdMap) const { for(auto iter = this->m_ttdRootTagToObjectMap.GetIterator(); iter.IsValid(); iter.MoveNext()) { objToLogIdMap.AddNew(iter.CurrentValue(), iter.CurrentKey()); } }
record_t *cursor_next(ALLOC * a, cursor_t * cur) { handle_t h; record_t *r; while (true) { if (cur->idx != NULL) { // using index if (IsEqual(cur->iter, cur->to)) { cur->end = 1; return NULL; } h = BTValue(cur->iter); } else { // full scan if (cur->hdl == 0) { cur->end = 1; return NULL; } h = cur->hdl; } if ((r = read_record(a, cur->tbl, h)) == NULL) { cur->error = 1; return NULL; } if (cur->idx != NULL) MoveNext(cur->iter); else cur->hdl = r->next; if (cursor_match(cur, cur->tbl, r)) return r; _free_record(r); } }
bool OdbcCommand::Execute(const tstring & szSQL) { if (!Open()) return false; #ifdef _DEBUG OutputDebugString((szSQL + _T("\n")).c_str()); #endif if (!BindParameters()) return false; if (!SQL_SUCCEEDED(SQLExecDirect(m_hStmt, (SQLTCHAR *)szSQL.c_str(), szSQL.length()))) { if (m_odbcConnection != NULL) m_szError = m_odbcConnection->ReportSQLError(SQL_HANDLE_STMT, m_hStmt, (TCHAR *)szSQL.c_str(), _T("Failed to execute statement.")); else m_szError = OdbcConnection::GetSQLError(SQL_HANDLE_STMT, m_hStmt); Close(); return false; } if (!MoveNext()) MoveNextSet(); return true; }
void InflateMap::PrepForReInflate(uint32 ctxCount, uint32 handlerCount, uint32 typeCount, uint32 objectCount, uint32 bodyCount, uint32 dbgScopeCount, uint32 envCount, uint32 slotCount) { this->m_typeMap.Initialize(typeCount); this->m_handlerMap.Initialize(handlerCount); this->m_tagToGlobalObjectMap.Initialize(ctxCount); this->m_debuggerScopeHomeBodyMap.Initialize(dbgScopeCount); this->m_debuggerScopeChainIndexMap.Initialize(dbgScopeCount); this->m_environmentMap.Initialize(envCount); this->m_slotArrayMap.Initialize(slotCount); this->m_promiseDataMap.Clear(); //We re-use these values (and reset things below) so we don't neet to initialize them here //m_objectMap //m_functionBodyMap //copy info we want to reuse into the old maps this->m_oldObjectMap.MoveDataInto(this->m_objectMap); this->m_oldFunctionBodyMap.MoveDataInto(this->m_functionBodyMap); //allocate the old pin set and fill it TTDAssert(this->m_oldInflatePinSet == nullptr, "Old pin set is not null."); Recycler* pinRecycler = this->m_inflatePinSet->GetAllocator(); this->m_oldInflatePinSet.Root(RecyclerNew(pinRecycler, ObjectPinSet, pinRecycler, this->m_inflatePinSet->Count()), pinRecycler); for(auto iter = this->m_inflatePinSet->GetIterator(); iter.IsValid(); iter.MoveNext()) { this->m_oldInflatePinSet->AddNew(iter.CurrentKey()); } this->m_inflatePinSet->Clear(); this->m_environmentPinSet->Clear(); this->m_slotArrayPinSet->Clear(); }
void CLryEDBQryDoc::OnDeleteRecord() { HRESULT hr; try { if((theApp.UserInfo.bLogon()== TRUE)&& (ID_OK==MessageBox(NULL,_T("确认删除记录吗?"),_T("警告!"),MB_OKCANCEL+MB_ICONWARNING+MB_TASKMODAL))) { pObj.RowNO = Rs->AbsolutePosition-1; hr = Rs->Delete(adAffectCurrent); TESTHR(hr); hr = Rs->Update(); TESTHR(hr); hr = MoveNext(); TESTHR(hr); //hr = MovePrevious(); //TESTHR(hr); UpdateAllViews(NULL,2,&pObj); } } catch(_com_error &e) { dump_com_error(e); } }
BOOL COledbRecordset::Open(LPCTSTR pstrSQL, long lType /*= DB_OPEN_TYPE_FORWARD_ONLY*/, long lOptions /*= DB_OPTION_DEFAULT*/) { _ASSERTE(m_pDb==NULL || m_pDb->IsOpen()); _ASSERTE(!::IsBadStringPtr(pstrSQL,(UINT)-1)); HRESULT Hr; // Close old recordset Close(); m_nRowsAffected = 0; // Create a new recordset CComQIPtr<IDBCreateCommand> spCreate = m_pDb->m_spSession; if( spCreate == NULL ) return FALSE; CComPtr<ICommand> spCommand; Hr = spCreate->CreateCommand(NULL, IID_ICommand, (LPUNKNOWN*) &spCommand); if( FAILED(Hr) ) return _Error(Hr); // Set type COledbDatabase::_SetRecordsetType(spCommand, lType, lOptions); // Set SQL CComQIPtr<ICommandText> spText = spCommand; _ASSERTE(spText); USES_CONVERSION; Hr = spText->SetCommandText(DBGUID_DBSQL, T2COLE(pstrSQL)); if( FAILED(Hr) ) return _Error(Hr); // Execute... Hr = spText->Execute(NULL, IID_IRowset, NULL, &m_nRowsAffected, (LPUNKNOWN*) &m_spRowset); if( FAILED(Hr) ) return _Error(Hr); // Bind columns if( !_BindColumns() ) return FALSE; return MoveNext(); }
inline void Queue<T>::EnQueue(const T &Item) { // Error Check: Make sure we aren't exceeding the maximum storage space assert(!IsFull()); _data[_tail] = Item; _tail = MoveNext(_tail); }
//-------------------------------------------------------------------------- void BackLayer::RematchImage(class ASprite** pAsprite) //-------------------------------------------------------------------------- { for(InitList(pObjectList);NotEndList(pObjectList);MoveNext(pObjectList)) { GetData(pObjectList)->pAsIns->m_sprite = pAsprite[GetData(pObjectList)->spridx]; } }
RuntimeContextInfo::~RuntimeContextInfo() { for(auto iter = this->m_coreObjToPathMap.GetIterator(); iter.IsValid(); iter.MoveNext()) { TT_HEAP_DELETE(UtilSupport::TTAutoString, iter.CurrentValue()); } for(auto iter = this->m_coreBodyToPathMap.GetIterator(); iter.IsValid(); iter.MoveNext()) { TT_HEAP_DELETE(UtilSupport::TTAutoString, iter.CurrentValue()); } for(auto iter = this->m_coreDbgScopeToPathMap.GetIterator(); iter.IsValid(); iter.MoveNext()) { TT_HEAP_DELETE(UtilSupport::TTAutoString, iter.CurrentValue()); } }
BOOL COledbRecordset::Attach(IRowset* pRowset) { Close(); m_spRowset = pRowset; if( !_BindColumns() ) return TRUE; // In case of UPDATE/INSERT without a result // then there are no columns return MoveNext(); }
void Mocking::MockedNetworkEngine::send(int idx, Log* log) { auto enumerator = this->_target_machine_ids->GetEnumerator(); while (enumerator.MoveNext()) { std::cout << "MockedNetworkEngine is sending to data node " << enumerator.Current->Value << std::endl; auto msg = std::make_shared<UpdateMessage>(idx, log); Microsoft::PSharp::Interop::Runtime::send(enumerator.Current, gcnew Events::MessageEvent(msg.get())); } }
inline T Queue<T>::DeQueue(void) { // Error Check: Make sure we aren't popping from an empty Queue assert(!IsEmpty()); T item = _data[_head]; _head = MoveNext(_head); return item; }
BOOL CSourceODBC::stdFillTable1(CString field1, CString& strValue1, CString field2, long& lngValue2) { if ( IsEOF() ) return FALSE; strValue1 = m_database.GetColomn(CString(field1))->GetValueAsString(); lngValue2 = m_database.GetColomn(CString(field2))->GetValueAsLong(); MoveNext(); if ( IsEOF() ) return FALSE; return TRUE; }
inline bool Queue<T>::IsFull () { if(MoveNext(_tail) == _head) { return true; } else { return false; } } // ----- end of method Queue<T>::IsFull -----
BOOL CSourceODBC::SetPosition(long position) { if ( m_lRecordCount == 0 ) return FALSE; if ( position == m_lCurrentRecord ) return TRUE; MoveFirst(); for( long i=0; i < position; i++ ) { MoveNext(); } return TRUE; }
void output(BTree *bt) { BTreeEnum btn; BTreeEnum invalid; EnumBegin(&btn, bt); EnumEnd(&invalid, bt); for(; !IsEqual(&btn, &invalid); MoveNext(&btn)) { //printf("%s %"PRIu64"\n", BTKey(&btn), BTValue(&btn)); printf("%d:%"PRIu64"\n", *(int*)BTKey(&btn), BTValue(&btn)); } puts("Enum done"); }
inline ConstStringS _Find_CodePage_From_Charset(const ConstStringS& strCharset) throw() { ConstArray<_Charset_CP> c_arr(g_charset_cp_map::GetAddress(), g_charset_cp_map::GetCount()); auto iter(c_arr.GetBegin()); for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) { const _Charset_CP& cc = iter.get_Value(); if( ConstStringCompareTrait<ConstStringS>::IsEQ(strCharset, ConstStringS(cc.m_charset.m_first, cc.m_charset.m_size)) ) { return ConstStringS(cc.m_codepage.m_first, cc.m_codepage.m_size); } } return ConstStringS(); }
void CSessions::clearRecords() { if (!IsBOF() || !IsEOF()) { while (!IsEOF()) { Delete(); MoveNext(); } } }
TTDCompareMap::~TTDCompareMap() { TT_HEAP_FREE_ARRAY(char16, this->PathBuffer, 256); TT_HEAP_FREE_ARRAY(TTD::fPtr_AssertSnapEquivAddtlInfo, this->SnapObjCmpVTable, (int32)NSSnapObjects::SnapObjectType::Limit); //delete all the compare paths for(auto iter = this->H1PtrToPathMap.GetIterator(); iter.IsValid(); iter.MoveNext()) { TT_HEAP_DELETE(TTDComparePath, iter.CurrentValue()); } }
inline uint _Find_LCID_From_ShortString(const ConstStringS& strShortString, uint& uIndex) throw() { ConstArray<_LCID_ShortString> c_arr(g_lcid_short_string_map::GetAddress(), g_lcid_short_string_map::GetCount()); auto iter(c_arr.GetBegin()); for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) { const _LCID_ShortString& ls = iter.get_Value(); if( ConstStringCompareTrait<ConstStringS>::IsEQ(strShortString, ConstStringS(ls.m_short_string.m_first, ls.m_short_string.m_size)) ) { uIndex = ls.m_uIndex; return ls.m_lcid; } } return 0; }
inline ConstStringS _Find_ShortString_From_LCID(uint uLCID, uint& uIndex) throw() { ConstArray<_LCID_ShortString> c_arr(g_lcid_short_string_map::GetAddress(), g_lcid_short_string_map::GetCount()); auto iter(c_arr.GetBegin()); for( ; iter != c_arr.GetEnd(); iter.MoveNext() ) { const _LCID_ShortString& ls = iter.get_Value(); if( ls.m_lcid == uLCID ) { uIndex = ls.m_uIndex; return ConstStringS(ls.m_short_string.m_first, ls.m_short_string.m_size); } } return ConstStringS(); }
BOOL CSetVorlagen::UpdateVorlage() { BOOL result = FALSE; BOOL found = FALSE; CString key, name, pfad; long typ; key = m_Kode; name = m_Name; pfad = m_Pfad; typ = m_Typ; try { Open(); while ( !IsEOF()) { if ( found = ( key == m_Kode )) break; MoveNext(); } if ( found ) Edit(); else AddNew(); m_Kode = key; m_Name = name; m_Pfad = pfad; m_Typ = typ; Update(); Close(); result = TRUE; } catch ( CDBException *e ) { AfxMessageBox( e -> m_strError ); } catch ( CMemoryException *e) { AfxMessageBox( g_cbMemoryException ); e -> Delete(); } catch (...) { AfxMessageBox( g_cbUnhandeledException ); } if ( result ) InitListen(); return result; }
void CSourceODBC::ReQuestion() { Requery(); m_database.recordcount = 0; if ( m_lRecordCount > 0 ) { MoveFirst(); while( !IsEOF() ) { m_database.recordcount++; MoveNext(); } } }
BOOL CSqlite3Recordset::_Attach(sqlite3_stmt* pVm) { Close(); m_pVm = pVm; m_ppSnapshot = NULL; m_lType = DB_OPEN_TYPE_FORWARD_ONLY; m_lOptions = 0; m_nCols = ::sqlite3_column_count(pVm); m_nRows = 0; m_iPos = -1; m_fEOF = FALSE; m_bAttached = true; return MoveNext(); }