示例#1
0
OGRErr OGRGMELayer::SetFeature( OGRFeature *poFeature )

{
    if (!poFeature)
        return OGRERR_FAILURE;
    long nFID = poFeature->GetFID();
    if(bInTransaction) {
        std::map<int, OGRFeature *>::const_iterator fit;
        fit = omnpoInsertedFeatures.find(nFID);
        if (fit != omnpoInsertedFeatures.end()) {
            omnpoInsertedFeatures[nFID] = poFeature->Clone();
            CPLDebug("GME", "Updated Feature %ld in Transaction", nFID);
        }
        else {
            unsigned int iBatchSize = GetBatchPatchSize();
            if (omnpoUpdatedFeatures.size() >= iBatchSize) {
                CPLDebug("GME", "BatchPatch, reached BatchSize of %d", iBatchSize);
                OGRErr iBatchInsertResult = BatchPatch();
                if (iBatchInsertResult != OGRERR_NONE) {
                    return iBatchInsertResult;
                }
            }
            CPLDebug("GME", "In Transaction, add update to Transaction");
            bDirty = true;
            omnpoUpdatedFeatures[nFID] = poFeature->Clone();
        }
        return OGRERR_NONE;
    }
    else {
        omnpoUpdatedFeatures[nFID] = poFeature->Clone();
        CPLDebug("GME", "Not in Transaction, BatchPatch()");
        return BatchPatch();
    }
}
示例#2
0
OGRErr OGRGMELayer::SetFeature( OGRFeature *poFeature )

{
    if (!poFeature)
        return OGRERR_FAILURE;
    long nFID = poFeature->GetFID();
    if(bInTransaction) {
        std::map<int, OGRFeature *>::const_iterator fit;
        fit = omnpoInsertedFeatures.find(nFID);
        if (fit != omnpoInsertedFeatures.end()) {
            omnpoInsertedFeatures[nFID] = poFeature->Clone();
            CPLDebug("GME", "Updated Feature %ld in Transaction", nFID);
        }
        else {
            CPLDebug("GME", "In Transaction, add update to Transaction");
            bDirty = true;
            omnpoUpdatedFeatures[nFID] = poFeature->Clone();
        }
        return OGRERR_NONE;
    }
    else {
        omnpoUpdatedFeatures[nFID] = poFeature->Clone();
        CPLDebug("GME", "Not in Transaction, BatchPatch()");
        return BatchPatch();
    }
}
示例#3
0
OGRErr OGRGMELayer::SyncToDisk()

{
    CPLDebug("GME", "SyncToDisk()");
    if (bDirty) {
        if (omnpoInsertedFeatures.size() > 0) {
            BatchInsert();
        }
        if (omnpoUpdatedFeatures.size() > 0) {
            BatchPatch();
        }
        if (oListOfDeletedFeatures.size() > 0) {
            BatchDelete();
        }
        bDirty = false;
    }
    return OGRERR_NONE;
}