本文整理汇总了C++中MojDbCursor::kindEngine方法的典型用法代码示例。如果您正苦于以下问题:C++ MojDbCursor::kindEngine方法的具体用法?C++ MojDbCursor::kindEngine怎么用?C++ MojDbCursor::kindEngine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojDbCursor
的用法示例。
在下文中一共展示了MojDbCursor::kindEngine方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: find
MojErr MojDbKindEngine::find(const MojDbQuery& query, MojDbCursor& cursor, MojDbWatcher* watcher, MojDbReq& req, MojDbOp op)
{
MojAssert(isOpen());
MojLogTrace(s_log);
MojErr err = query.validate();
MojErrCheck(err);
// In order to find collate index, cursor needs kindEngine
cursor.kindEngine(this);
err = cursor.init(query);
MojErrCheck(err);
MojDbKind* kind = NULL;
err = getKind(query.from().data(), kind);
MojErrCheck(err);
MojAssert(kind);
err = kind->find(cursor, watcher, req, op);
MojErrCheck(err);
cursor.kindEngine(this);
return MojErrNone;
}
示例2: updateSupers
MojErr MojDbKind::updateSupers(const KindMap& map, const StringVec& superIds, bool updating, MojDbReq& req)
{
MojLogTrace(s_log);
MojInt32 indexes = 0;
if (updating) {
KindVec addedSupers;
MojErr err = diffSupers(map, superIds, m_superIds, addedSupers);
MojErrCheck(err);
KindVec removedSupers;
err = diffSupers(map, m_superIds, superIds, removedSupers);
MojErrCheck(err);
// remove/add our objects from new/removed supers
if (!addedSupers.empty() || !removedSupers.empty()) {
MojDbQuery query;
err = query.from(m_id);
MojErrCheck(err);
err = query.includeDeleted(true);
MojErrCheck(err);
MojDbCursor cursor;
cursor.kindEngine(m_kindEngine);
err = find(cursor, NULL, req, OpKindUpdate);
MojErrCheck(err);
for (;;) {
MojObject obj;
bool found = false;
err = cursor.get(obj, found);
MojErrCheck(err);
if (!found)
break;
for (KindVec::ConstIterator i = addedSupers.begin(); i != addedSupers.end(); ++i) {
err = (*i)->updateOwnIndexes(&obj, NULL, req, indexes);
MojErrCheck(err);
}
for (KindVec::ConstIterator i = removedSupers.begin(); i != removedSupers.end(); ++i) {
err = (*i)->updateOwnIndexes(NULL, &obj, req, indexes);
MojErrCheck(err);
}
}
}
}
// remove old supers
m_superIds = superIds;
MojErr err = clearSupers();
MojErrCheck(err);
// look for new supers
for (StringVec::ConstIterator i = m_superIds.begin(); i != m_superIds.end(); ++i) {
KindMap::ConstIterator mapIter = map.find(*i);
if (mapIter != map.end()) {
err = addSuper(mapIter->get());
MojErrCheck(err);
}
}
// look for kinds that extend us
for (KindMap::ConstIterator i = map.begin(); i != map.end(); ++i) {
if ((*i)->m_superIds.find(m_id) != MojInvalidIndex) {
err = (*i)->addSuper(this);
MojErrCheck(err);
}
}
// add root kind if we have no supers
if (m_supers.empty()) {
KindMap::ConstIterator mapIter = map.find(MojDbKindEngine::RootKindId);
if (mapIter != map.end()) {
err = addSuper(mapIter->get());
MojErrCheck(err);
}
}
return MojErrNone;
}