ObjectResultPtr NoteFactory::create(const IntSeq& keys) { ConnectionHolder conn(_database); mysqlpp::Query query = conn.query(); query << "SELECT * FROM " << _noteTable << " WHERE noteId in ("; for (size_t i = 0; i < keys.size(); ++i) { query << keys.at(i) << ", "; } query << "0)"; mysqlpp::Result res = query.store(); ObjectResultPtr result = new ObjectResult; for (size_t i = 0; i < res.size(); ++i) { mysqlpp::Row row = res.at(i); NotePtr n = new Note; n->noteId = row["NOTEID"]; n->quoteeId = row["QUOTEEID"]; n->resource = row["RESOURCE"]; n->type = row["TYPE"]; n->unread = (int)row["UNREAD"] == 0 ? false : true; n->fromName = row["FROMNAME"].get_string(); n->fromId = row["FROMID"]; n->toId = row["TOID"]; n->ownerName = row["OWNERNAME"].get_string(); n->ownerId = row["OWNERID"]; n->title = row["TITLE"].get_string(); n->link = row["LINK"].get_string(); n->imageLink = row["IMAGELINK"].get_string(); n->timestamp = (time_t)mysqlpp::DateTime(row["TIMESTAMP"]); n->security = row["SECURITY"]; result->data[n->noteId] = n; } return result; }
TribeTinyViewSeq mop::hi::svc::model::UseredTribeManagerI::getMemberedTribeTinyViews(::Ice::Int userId, ::Ice::Int offset, ::Ice::Int limit, const Ice::Current& current) { UseredTribeServiceI& service = UseredTribeServiceI::instance(); IntSeq memberedTribeIds = service.getMemberedTribeSet(userId) ->getAll(offset, limit); TribeTinyViewSeq result; if (offset <= 0) { offset = 0; } if (limit <= 0) { limit = memberedTribeIds.size(); } for (int i = 0; i < memberedTribeIds.size(); ++i) { if (i < offset) { continue; } if (result.size() >= limit) { break; } try { result.push_back(service.getTribeTinyView(memberedTribeIds.at(i))); } catch (Ice::Exception& e) { } } return result; }
FeedDataSeq UserFeedSet::getFeedDataSeqByType(const IntSeq& types, int begin, int limit) { IceUtil::Mutex::Lock lock(_mutex); time_t t = time(NULL); _lastAccessTime = t; // if (t - _lastSortTime > 300) { // _lastSortTime = t; // TaskManager::instance().execute(new SortTask(this)); // } WeightIndex& index = _mergeGroupSet.get<1> (); FeedDataSeq seq; vector<WeightIndex::iterator> itSeq; if (index.size() < (unsigned int) (begin + limit) + 10) { // MCE_DEBUG("UserFeedSet::getFeedContentSeq --> _loadStat:"<<_loadStat<<" index.size(): "<<index.size()<<" begin: "<<begin<<" limit: "<<limit); if (_loadStat == 0) { load(); FeedItemManagerI::instance().addkickUser(_user); } } set<int> typeSet; for (size_t i = 0; i < types.size(); ++i) { typeSet.insert(types.at(i)); } WeightIndex::iterator iter = index.begin(); for (int k = 0; iter != index.end() && k < begin; ++iter) { int type = (*iter)->type(); if (typeSet.find(type) != typeSet.end()) { ++k; } } for (int h = 0; iter != index.end() && h < limit; ++iter) { int type = (*iter)->type(); if (typeSet.find(type) != typeSet.end()) { itSeq.push_back(iter); ++h; } } _buildFeedContents(index, itSeq, seq); MCE_DEBUG("UserFeedSet::getFeedContentSeq --> content.size:"<<seq.size()); return seq; }
BlockInfoSeq SSDFeedDBMasterAdapter::newBlockBatch(const IntSeq& ids){ if(ids.empty()){ return BlockInfoSeq(); } return getManager(ids.at(0), 1000)->newBlockBatch(ids); }
BlockInfoSeq SSDFeedDBMasterAdapter::getBlockBatch(const IntSeq& ids, bool write){ if(ids.empty()){ return BlockInfoSeq(); } return getManager(ids.at(0), 1000)->getBlockBatch(ids, write); }