本文整理汇总了C++中MojDbQuery::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ MojDbQuery::clear方法的具体用法?C++ MojDbQuery::clear怎么用?C++ MojDbQuery::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojDbQuery
的用法示例。
在下文中一共展示了MojDbQuery::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initQuery
MojErr MojDbDistinctTest::initQuery(MojDbQuery& query, const MojChar* queryString)
{
query.clear();
MojErr err = query.from(_T("DistinctTest:1"));
MojTestErrCheck(err);
err = query.distinct(queryString);
MojTestErrCheck(err);
err = query.order(queryString);
MojTestErrCheck(err);
return MojErrNone;
}
示例2: initQuery
MojErr MojDbSearchTest::initQuery(MojDbQuery& query, const MojChar* queryStr, const MojChar* orderBy, const MojObject& barVal, bool desc)
{
query.clear();
MojErr err = query.from(_T("SearchTest:1"));
MojTestErrCheck(err);
MojString val;
err = val.assign(queryStr);
MojTestErrCheck(err);
err = query.where(_T("foo"), MojDbQuery::OpSearch, val, MojDbCollationPrimary);
MojTestErrCheck(err);
query.desc(desc);
if (!barVal.undefined()) {
err = query.where(_T("bar"), MojDbQuery::OpEq, barVal);
MojTestErrCheck(err);
}
if (orderBy) {
err = query.order(orderBy);
MojTestErrCheck(err);
}
return MojErrNone;
}
示例3: simpleTest
MojErr MojDbSearchTest::simpleTest(MojDb& db)
{
// just foo
MojErr err = check(db, _T("bogus"), _T("[]"));
MojTestErrCheck(err);
err = check(db, _T("f"), _T("[1,2,3,4]"));
MojTestErrCheck(err);
err = check(db, _T("F"), _T("[1,2,3,4]"));
MojTestErrCheck(err);
err = check(db, _T("fo"), _T("[1,2,3,4]"));
MojTestErrCheck(err);
err = check(db, _T("four"), _T("[1,3,4]"));
MojTestErrCheck(err);
err = check(db, _T("score"), _T("[1]"));
MojTestErrCheck(err);
err = check(db, _T("four years"), _T("[1]"));
MojTestErrCheck(err);
err = check(db, _T("Four Years"), _T("[1]"));
MojTestErrCheck(err);
err = check(db, _T("four decades"), _T("[]"));
MojTestErrCheck(err);
err = check(db, _T("fathers forth"), _T("[2,3]"));
MojTestErrCheck(err);
err = check(db, _T("four f"), _T("[1,3,4]"));
MojTestErrCheck(err);
err = check(db, _T("four f fo fou"), _T("[1,3,4]"));
MojTestErrCheck(err);
// bar and foo
err = check(db, _T("f"), _T("[3]"), NULL, 2);
MojTestErrCheck(err);
// order by bar
err = check(db, _T("f"), _T("[4,3,2,1]"), _T("bar"));
MojTestErrCheck(err);
err = check(db, _T("f"), _T("[1,2,3,4]"), _T("bar"), MojObject::Undefined, true);
MojTestErrCheck(err);
err = check(db, _T("f"), _T("[4,3,1,2]"), _T("foo"));
MojTestErrCheck(err);
// array value for bar
MojObject array;
err = array.push(1);
MojErrCheck(err);
err = array.push(2);
MojErrCheck(err);
err = check(db, _T("f"), _T("[4,3]"), _T("bar"), array);
MojTestErrCheck(err);
// limit
MojDbQuery query;
err = initQuery(query, _T("f"));
MojTestErrCheck(err);
query.limit(2);
err = check(db, query, _T("[1,2]"));
MojTestErrCheck(err);
err = initQuery(query, _T("f"), _T("bar"));
MojTestErrCheck(err);
query.limit(2);
err = check(db, query, _T("[4,3]"));
MojTestErrCheck(err);
// accent insensitivity
err = check(db, _T("COTE"), _T("[5,6,7,8,9]"));
MojTestErrCheck(err);
// case-insensitive ordering
err = check(db, _T("a"), _T("[12,13,11]"), _T("foo"));
MojTestErrCheck(err);
// multi-prop
query.clear();
err = query.from(_T("SearchTest:1"));
MojTestErrCheck(err);
MojString val;
err = val.assign(_T("test"));
MojTestErrCheck(err);
err = query.where(_T("multiprop"), MojDbQuery::OpSearch, val, MojDbCollationPrimary);
MojTestErrCheck(err);
err = check(db, query, _T("[14,15]"));
MojTestErrCheck(err);
return MojErrNone;
}
示例4: delKind
MojErr MojDb::delKind(const MojObject& id, bool& foundOut, MojUInt32 flags, MojDbReqRef req)
{
MojLogTrace(s_log);
foundOut = false;
MojErr err = beginReq(req, true);
MojErrCheck(err);
// del kind obj
MojString idStr;
err = id.stringValue(idStr);
MojErrCheck(err);
MojDbKind *pk = NULL;
// If Kinds has sub-kinds, we give an error
err = m_kindEngine.getKind(idStr.data(), pk);
MojErrCheck(err);
if (pk->nsubkinds() > 0) {
MojLogWarning(s_log, _T("delKind_error: %s has %d subkinds \n"), idStr.data(), pk->nsubkinds());
MojErrThrow(MojErrDbKindHasSubKinds);
}
//MojLogInfo(s_log, _T("delKind: %s \n"), idStr.data());
MojLogWarning(s_log, _T("delKind: %s \n"), idStr.data());
err = m_kindEngine.checkOwnerPermission(idStr, req);
MojErrCheck(err);
MojString dbId;
err = formatKindId(idStr, dbId);
MojErrCheck(err);
MojObject deleted;
bool found = false;
MojDbAdminGuard adminGuard(req);
err = delImpl(dbId, found, deleted, req, flags);
MojErrCheck(err);
if (found) {
// del objects
MojDbQuery query;
err = query.from(idStr);
MojErrCheck(err);
err = query.includeDeleted(true);
MojErrCheck(err);
MojUInt32 count;
req->fixmode(true);
err = delImpl(query, count, req, flags | FlagPurge);
MojErrCheck(err);
// del associated permissions
query.clear();
err = query.from(MojDbKindEngine::PermissionId);
MojErrCheck(err);
err = query.where(MojDbServiceDefs::ObjectKey, MojDbQuery::OpEq, idStr);
MojErrCheck(err);
req->fixmode(true);
err = delImpl(query, count, req, flags);
MojErrCheck(err);
// del kind
MojErr errAcc = m_kindEngine.delKind(idStr, req);
MojErrAccumulate(err, errAcc);
}
err = commitKind(idStr, req, err);
MojErrCheck(err);
foundOut = found;
return MojErrNone;
}