コード例 #1
0
ファイル: thkeydiff.cpp プロジェクト: eagle518/HPCC-Platform
    virtual void done()
    {
        StringBuffer scopedName;
        OwnedRoxieString outputName(helper->getOutputName());
        queryThorFileManager().addScope(container.queryJob(), outputName, scopedName);
        Owned<IWorkUnit> wu = &container.queryJob().queryWorkUnit().lock();
        Owned<IWUResult> r = wu->updateResultBySequence(helper->getSequence());
        r->setResultStatus(ResultStatusCalculated);
        r->setResultLogicalName(scopedName.str());
        r.clear();
        wu.clear();

        IPropertyTree &patchProps = patchDesc->queryProperties();
        if (0 != (helper->getFlags() & KDPexpires))
            setExpiryTime(patchProps, helper->getExpiryDays());
        IPropertyTree &originalProps = originalDesc->queryProperties();;
        if (originalProps.queryProp("ECL"))
            patchProps.setProp("ECL", originalProps.queryProp("ECL"));
        if (originalProps.getPropBool("@local"))
            patchProps.setPropBool("@local", true);
        container.queryTempHandler()->registerFile(outputName, container.queryOwner().queryGraphId(), 0, false, WUFileStandard, &clusters);
        Owned<IDistributedFile> patchFile;
        // set part sizes etc
        queryThorFileManager().publish(container.queryJob(), outputName, false, *patchDesc, &patchFile, 0, false);
        try { // set file size
            if (patchFile) {
                __int64 fs = patchFile->getFileSize(true,false);
                if (fs!=-1)
                    patchFile->queryAttributes().setPropInt64("@size",fs);
            }
        }
        catch (IException *e) {
            EXCLOG(e,"keydiff setting file size");
            e->Release();
        }
        // Add a new 'Patch' description to the secondary key.
        DistributedFilePropertyLock lock(newIndexFile);
        IPropertyTree &fileProps = lock.queryAttributes();
        StringBuffer path("Patch[@name=\"");
        path.append(scopedName.str()).append("\"]");
        IPropertyTree *patch = fileProps.queryPropTree(path.str());
        if (!patch) patch = fileProps.addPropTree("Patch", createPTree());
        patch->setProp("@name", scopedName.str());
        unsigned checkSum;
        if (patchFile->getFileCheckSum(checkSum))
            patch->setPropInt64("@checkSum", checkSum);

        IPropertyTree *index = patch->setPropTree("Index", createPTree());
        index->setProp("@name", originalIndexFile->queryLogicalName());
        if (originalIndexFile->getFileCheckSum(checkSum))
            index->setPropInt64("@checkSum", checkSum);
        originalIndexFile->setAccessed();
        newIndexFile->setAccessed();
    }
コード例 #2
0
ファイル: hellodali.cpp プロジェクト: AlexLuya/HPCC-Platform
void doStuff()
{
    Owned<IRemoteConnection> conn = querySDS().connect("/Orbit", myProcessSession(), RTM_LOCK_WRITE|RTM_CREATE_QUERY, DALI_TIMEOUT);
    IPropertyTree *root = conn->queryRoot();
    StringBuffer s;
    if (root->getProp("TestBranch1",s)) {
        printf("TestBranch1: read %s\n",s.str());
    }
    else {

        // save as string
        printf("TestBranch1: set (as string)\n",s.str());
        root->setProp("TestBranch1",MyTestXML);
    }
    MemoryBuffer m;
    if (root->getPropBin("TestBranch2",m)) {
        m.append((byte)0); // add a NULL to returned data
        const char *str = m.toByteArray();  
        printf("TestBranch2: read %s\n",str);
    }
    else {
        // save as raw binary
        printf("TestBranch2: set (as blob)\n",s.str());
        root->setPropBin("TestBranch2",strlen(MyTestXML),MyTestXML); // include NULL
    }
    IPropertyTree *br3 = root->queryPropTree("TestBranch3");
    if (br3) {
        printf("read TestBranch3 as tree\n");
        printf("Hello = %s\n",br3->queryProp("Hello"));
        int n = br3->getPropInt("Bye/@num");        // update
        printf("Bye num = %d\n",n);
        br3->setPropInt("Bye/@num",n+1);
    }
    else {
        // save as tree
        printf("TestBranch3: set (as tree)\n",s.str());
        br3 =  createPTreeFromXMLString(MyTestXML); // parses and creates object tree
        root->setPropTree("TestBranch3", br3);
    }
}
コード例 #3
0
ファイル: hqlxmldb.cpp プロジェクト: aa0/HPCC-Platform
void CXmlScope::loadXML(const char * text, const char * element)
{
    IPropertyTree * ptree = createPTreeFromXMLString(text, ipt_caseInsensitive);
    root->setPropTree(element, ptree);
}