u_result u_readerDeinit( u_reader _this) { u_result result; u_query query; if (_this != NULL) { result = u_dispatcherDeinit(u_dispatcher(_this)); if (result == U_RESULT_OK) { os_mutexLock(&_this->mutex); if (_this->queries) { query = c_iterObject(_this->queries,0); while (query) { os_mutexUnlock(&_this->mutex); result = u_queryFree(query); os_mutexLock(&_this->mutex); query = c_iterObject(_this->queries,0); } c_iterFree(_this->queries); _this->queries = NULL; } os_mutexUnlock(&_this->mutex); os_mutexDestroy(&_this->mutex); } } else { result = U_RESULT_ILL_PARAM; } 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; }
void _ReadConditionDispose( _ReadCondition readcondition) { u_query query; query = readcondition->uQuery; _Condition(readcondition)->uEntity = u_entity(0); _ConditionDispose(_Condition(readcondition)); u_queryFree(query); }
gapi_returnCode_t _DataReaderViewFree ( _DataReaderView dataReaderView) { gapi_returnCode_t result = GAPI_RETCODE_OK; u_dataView v; assert(dataReaderView); u_queryFree(dataReaderView->uQuery); gapi_loanRegistry_free(dataReaderView->loanRegistry); v = U_DATAREADERVIEW_GET(dataReaderView); _EntityDispose (_Entity(dataReaderView)); u_dataViewFree(v); return result; }