Exemple #1
0
u_result
u_readerTakeNextInstance(
    u_reader r,
    u_instanceHandle h,
    u_readerAction action,
    c_voidp actionArg)
{
    u_result result;

    switch (u_entity(r)->kind) {
    case U_READER:
        result = u_dataReaderTakeNextInstance(u_dataReader(r), h, action, actionArg);
    break;
    case U_DATAVIEW:
        result = u_dataViewTakeNextInstance(u_dataView(r), h, action, actionArg);
    break;
    case U_QUERY:
        result = u_queryTakeNextInstance(u_query(r), h, action, actionArg);
    break;
    default:
        result = U_RESULT_ILL_PARAM;
    break;
    }
    return result;
}
Exemple #2
0
void *
u_readerTakeList(
    u_reader r,
    c_ulong max,
    u_readerCopyList copy,
    c_voidp copyArg)
{
    void *result = NULL;

    switch (u_entity(r)->kind) {
    case U_READER:
        result = u_dataReaderTakeList(u_dataReader(r), max, copy, copyArg);
    break;
    case U_DATAVIEW:
        assert(FALSE);
    break;
    case U_QUERY:
        result = u_queryTakeList(u_query(r), max, copy, copyArg);
    break;
    default:
        result = NULL;
    break;
    }
    return result;
}
/*     ReturnCode_t
 *     delete_contained_entities();
 */
gapi_returnCode_t
gapi_dataReaderView_delete_contained_entities (
    gapi_dataReaderView _this)
{
    gapi_returnCode_t result = GAPI_RETCODE_OK;
    _DataReaderView datareaderview;
    gapi_context context;
    _Condition condition = NULL;
    c_iter entities;
    u_entity e;
    u_result ur;

    GAPI_CONTEXT_SET(context, _this, GAPI_METHOD_DELETE_CONTAINED_ENTITIES);

    if ( _this != NULL ) {
        datareaderview = gapi_dataReaderViewClaim(_this, &result);
        if ( datareaderview != NULL ) {
            if (!gapi_loanRegistry_is_empty(datareaderview->loanRegistry)) {
                result = GAPI_RETCODE_PRECONDITION_NOT_MET;
            } else {
                entities = u_readerLookupQueries(U_READER_GET(datareaderview));
                e = c_iterTakeFirst(entities);
                while (e) {
                    condition = u_entityGetUserData(e);
                    if (condition) {
                        _ObjectReadClaimNotBusy(_Object(condition));
                        _ConditionFree(condition);
                    } else {
                        if (e == u_entity(datareaderview->uQuery)) {
                            datareaderview->uQuery = NULL;
                            ur = u_queryFree(u_query(e));
                            if (ur == U_RESULT_OK) {
                                result = GAPI_RETCODE_OK;
                            } else {
                                result = GAPI_RETCODE_BAD_PARAMETER;
                            }
                        } else {
                            assert(condition);
                            result = GAPI_RETCODE_BAD_PARAMETER;
                        }
                    }
                    e = c_iterTakeFirst(entities);
                }
                c_iterFree(entities);
            }
            _EntityRelease(datareaderview);
        } else {
            result = GAPI_RETCODE_ALREADY_DELETED;
        }
    } else {
        result = GAPI_RETCODE_BAD_PARAMETER;
    }

    return result;
}
Exemple #4
0
u_result
u_readerRead(
    u_reader r,
    u_readerAction action,
    c_voidp actionArg)
{
    u_result result;
    switch (u_entity(r)->kind) {
    case U_READER:
        result = u_dataReaderRead(u_dataReader(r), action, actionArg);
    break;
    case U_DATAVIEW:
        result = u_dataViewRead(u_dataView(r), action, actionArg);
    break;
    case U_QUERY:
        result = u_queryRead(u_query(r), action, actionArg);
    break;
    default:
        result = U_RESULT_ILL_PARAM;
    break;
    }
    return result;
}