inline bean_ptr<C> Database::manageBean(C* ptr) { sqlid_t id=allocId( Database::getClassName<C>() ); bean_key key(con,id); dbUpdate(key,*ptr); return Registry<C>::createBeanPtr(key,ptr); }
void WordIdManager::updateWordIdModel(vector<string>& wordStream) { int res, i; bool fail = false; for(i = 0; i < wordStream.size() && !fail; i++){ res = allocId(wordStream[i]); if(res == 0){ cout << "ERROR out of U32 word-id keys" << endl; fail = true; } } }
/* Finds word in id table; if not found, attempts to alloc a new id. */ U32 WordIdManager::stringToId(const string& word) { U32 id; WordTableIt it = m_wordTable.find(word); if(it == m_wordTable.end()){ //cout << "WARN word-id not found for >" << word << "< attempting to alloc new id. Verify m_wordTable and m_idTable alignment." << endl; id = allocId(word); if(id == 0){ cout << "ERROR out of keys in getId()" << endl; } } else{ id = it->second; } return id; }