Example #1
0
static void convertResult(EXTfldval& row, OmnisTools::ParamMap& params) {
    
    OmnisTools::ParamMap::iterator it;
    str255 colName;
    EXTfldval colVal;
    EXTqlist* retList = new EXTqlist(listVlen); // Return row
    
    // Add all output columns
    colName = initStr255("Result");
    retList->addCol(fftRow, dpDefault, 0, &colName);
    
    retList->insertRow();
    
    // Look for output data
    it = params.find("Result");
    if( it != params.end()) {
        retList->getColValRef(1,1,colVal,qtrue);
        
        try {
            boost::shared_ptr<EXTqlist> ptr = boost::any_cast<boost::shared_ptr<EXTqlist> >(it->second);
            colVal.setList(ptr.get(), qtrue); 
        } catch( const boost::bad_any_cast& e ) {
            LOG_ERROR << "Unable to cast return value from PostgreSQL worker.";
        }
    }
    
    row.setList(retList,qtrue);
}
Example #2
0
// Convert the current value object into a list
void JsonValue::methodValueToList( tThreadData* pThreadData, qshort pParamCount ) {

    if (!(jsonValue->isObject() || jsonValue->isArray())) {
        pThreadData->mExtraErrorText = "Value is not an object or an array.  Can only convert single objects or arrays of objects to a list.";
    }

    EXTfldval retVal;
    EXTqlist* retList = new EXTqlist(listVlen);

    str255 colName;
    EXTfldval colVal, colNameVal;

    // Write container object directly to list
    if ( writeValueToList(pThreadData, retList, 0, jsonValue, 0,0) ) {
        // Return list
        retVal.setList(retList, qtrue);
        ECOaddParam(pThreadData->mEci, &retVal);

    } else {
        delete retList;
        // DEV NOTE: writeValueToList will write extra error text
    }
}