Esempio n. 1
0
    void IData::bsonValueFromObj(bson::bo obj) 
    {
        bson::bo::iterator objIter(obj);
        if (!objIter.more())
        {
            return;
        }

        bson::be element = *objIter;
        if (strcmp(element.fieldName(), "_t") == 0)
        {
            if (objIter.more())
            {
                ++objIter;
                bsonValueFromObj_v2(objIter);
            }
        }
        else if (strcmp(element.fieldName(), "_typeId") == 0)
        {
            if (objIter.more())
            {
                ++objIter;
                bsonValueFromObj_v1(objIter);
            }
        } else {
            bsonValueFromObj_v1(objIter);
        }
    }
Esempio n. 2
0
void CSyncSource::processSyncCommand(const String& strCmd, CJSONEntry oCmdEntry)
{
    CJSONStructIterator objIter(oCmdEntry);

    for( ; !objIter.isEnd() && getSync().isContinueSync(); objIter.next() )
    {
        String strObject = objIter.getCurKey();
        CJSONStructIterator attrIter( objIter.getCurValue() );
        if ( m_bSchemaSource )
            processServerCmd_Ver3_Schema(strCmd,strObject,attrIter);
        else
        {
            for( ; !attrIter.isEnd() && getSync().isContinueSync(); attrIter.next() )
            {
                String strAttrib = attrIter.getCurKey();
                String strValue = attrIter.getCurString();

                processServerCmd_Ver3(strCmd,strObject,strAttrib,strValue);
            }
        }

        if ( getSyncType().compare("none") == 0 )
            continue;

        int nSyncObjectCount  = getNotify().incLastSyncObjectCount(getID());
        if ( getProgressStep() > 0 && (nSyncObjectCount%getProgressStep() == 0) )
            getNotify().fireSyncNotification(this, false, RhoAppAdapter.ERR_NONE, "");

        if ( getDB().isUIWaitDB() )
        {
	        LOG(INFO) + "Commit transaction because of UI request.";
            getDB().endTransaction();
            CSyncThread::getInstance()->sleep(1000);
            getDB().startTransaction();
        }

    }
}