本文整理汇总了C++中OwnedHqlExpr::queryChild方法的典型用法代码示例。如果您正苦于以下问题:C++ OwnedHqlExpr::queryChild方法的具体用法?C++ OwnedHqlExpr::queryChild怎么用?C++ OwnedHqlExpr::queryChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OwnedHqlExpr
的用法示例。
在下文中一共展示了OwnedHqlExpr::queryChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createBrowseWU
bool QueryDataSource::createBrowseWU()
{
StringAttr dataset, datasetDefs;
StringAttrAdaptor a1(dataset), a2(datasetDefs);
wuResult->getResultDataset(a1, a2);
if (!dataset || !datasetDefs)
return false;
StringBuffer fullText;
fullText.append(datasetDefs).append(dataset);
OwnedHqlExpr parsed = parseQuery(fullText.str());
if (!parsed)
return false;
HqlExprAttr selectFields = parsed.getLink();
if (selectFields->getOperator() == no_output)
selectFields.set(selectFields->queryChild(0));
OwnedHqlExpr browseWUcode = buildQueryViewerEcl(selectFields);
if (!browseWUcode)
return false;
returnedRecord.set(browseWUcode->queryChild(0)->queryRecord());
StringAttr tempAttr;
StringAttrAdaptor temp(tempAttr);
Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
Owned<IConstWorkUnit> parent = factory->openWorkUnit(wuid, false);
SCMStringBuffer user;
StringAttrAdaptor acluster(cluster);
parent->getClusterName(acluster);
parent->getUser(user);
Owned<IWorkUnit> workunit = factory->createWorkUnit(NULL, "fileViewer", user.str());
workunit->setUser(user.str());
workunit->setClusterName(cluster);
workunit->setCustomerId(parent->getCustomerId(temp).str());
workunit->setCompareMode(CompareModeOff); // ? parent->getCompareMode()
StringAttrAdaptor bwa(browseWuid); workunit->getWuid(bwa);
workunit->setDebugValueInt("importImplicitModules", false, true);
workunit->setDebugValueInt("importAllModules", false, true);
workunit->setDebugValueInt("forceFakeThor", 1, true);
StringBuffer jobName;
jobName.append("FileView for ").append(wuid).append(":").append("x");
workunit->setJobName(jobName.str());
StringBuffer eclText;
toECL(browseWUcode, eclText, true);
Owned<IWUQuery> query = workunit->updateQuery();
query->setQueryText(eclText.str());
query->setQueryName(jobName.str());
return true;
}
示例2: switch
IHqlExpression * PositionTransformer::createTransformed(IHqlExpression * _expr)
{
OwnedHqlExpr transformed = NewHqlTransformer::createTransformed(_expr);
switch (transformed->getOperator())
{
case no_table:
{
IHqlExpression * mode = transformed->queryChild(2);
HqlExprArray fields;
HqlExprArray args;
if (mode->getOperator() == no_thor)
{
unwindChildren(fields, transformed->queryChild(1));
IHqlExpression * filePosAttr = createComma(createAttribute(virtualAtom, createAttribute(filepositionAtom)), insertedAttr.getLink());
IHqlExpression * sizeofAttr = createComma(createAttribute(virtualAtom, createAttribute(sizeofAtom)), insertedAttr.getLink());
fields.append(*createField(fileposName, makeIntType(8, false), NULL, filePosAttr));
fields.append(*createField(recordlenName, makeIntType(2, false), NULL, sizeofAttr));
unwindChildren(args, transformed);
args.replace(*createRecord(fields), 1);
return transformed->clone(args);
}
}
break;
case no_iterate:
case no_hqlproject:
{
HqlExprArray args;
HqlExprArray assigns;
IHqlExpression * transform = transformed->queryChild(1);
unwindChildren(args, transformed);
unwindChildren(assigns, transform);
IHqlExpression * inRecord = transformed->queryChild(0)->queryRecord();
IHqlExpression * outRecord = transform->queryRecord();
HqlExprArray fields;
unwindChildren(fields, outRecord);
ForEachChild(idx, inRecord)
{
IHqlExpression * child = inRecord->queryChild(idx);
if (child->hasProperty(insertedAtom))
{
IHqlExpression * newTarget = createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink());
fields.append(*newTarget);
assigns.append(*createValue(no_assign, makeVoidType(), newTarget, createSelectExpr(createValue(no_left), LINK(newTarget))));
}
}
IHqlExpression * newRecord = createRecord(fields);
args.replace(*createValue(no_transform, newRecord->getType(), assigns), 1);
return transformed->clone(args);
}
break;
case no_join:
//only ok if join first
case no_rollup:
case no_newaggregate:
case no_aggregate:
fail();
break;
case no_usertable:
case no_selectfields:
{
IHqlExpression * grouping = transformed->queryChild(2);
if (grouping && (grouping->getOperator() != no_attr))
fail();
IHqlExpression * record = transformed->queryRecord();
HqlExprArray fields;
unwindChildren(fields, transformed->queryChild(1));
ForEachChild(idx, record)
{
IHqlExpression * child = record->queryChild(idx);
if (child->hasProperty(insertedAtom))
fields.append(*createField(child->queryName(), child->getType(), LINK(child), insertedAttr.getLink()));
}
HqlExprArray args;
unwindChildren(args, transformed);
args.replace(*createRecord(fields), 1);
return transformed->clone(args);
}