Пример #1
0
void kr_data_destruct(T_KRData *ptData)
{
    if (ptData) {
        kr_hashtable_destroy(ptData->ptItemTable);
        kr_free(ptData);
    }
}
Пример #2
0
void kr_index_drop(T_KRIndex *ptIndex)
{
    kr_list_remove(ptIndex->ptDB->pIndexList, ptIndex);
    kr_hashtable_destroy(ptIndex->pHashTable);
    kr_list_destroy(ptIndex->pIndexTableList);
    kr_free(ptIndex);
}
Пример #3
0
T_KRHDITable *kr_hdi_table_construct(T_KRParamHDI *ptParamHDI, T_KRModule *ptModule)
{
    T_KRHDITable *ptHdiTable = kr_calloc(sizeof(T_KRHDITable));
    if (ptHdiTable == NULL) {
        KR_LOG(KR_LOGERROR, "kr_calloc ptHdiTable failed!");
        return NULL;
    }
    ptHdiTable->ptParamHDI = ptParamHDI;
    ptHdiTable->lHDICnt = ptParamHDI->lHDIDefCnt;
    ptHdiTable->ptHDITable = \
      kr_hashtable_new_full(kr_long_hash, kr_long_equal, \
                            NULL, (KRDestroyNotify )kr_hdi_destruct);
    
    int i = 0;
    T_KRHDI *ptHDI = NULL;
    for (i=0; i<ptParamHDI->lHDIDefCnt; ++i) {
        ptHDI = kr_hdi_construct(&ptParamHDI->stParamHDIDef[i], ptModule);
        if (ptHDI == NULL) {
            KR_LOG(KR_LOGERROR, "kr_hdi_construct [%d] failed!", i);
            kr_hashtable_destroy(ptHdiTable->ptHDITable);
            kr_free(ptHdiTable);
            return NULL;
        }
        kr_hashtable_insert(ptHdiTable->ptHDITable, &ptHDI->lHDIId, ptHDI);
    }
    ptHdiTable->tConstructTime = ptParamHDI->tLastLoadTime;
    
    return ptHdiTable;    
}
Пример #4
0
T_KRHDITable *kr_hdi_table_construct(T_KRShmHDI *shm_hdi, T_KRModule *datamodule)
{
    T_KRHDITable *krhditable = kr_calloc(sizeof(T_KRHDITable));
    if (krhditable == NULL) {
        KR_LOG(KR_LOGERROR, "kr_calloc krhditable failed!");
        return NULL;
    }
    krhditable->ptShmHDIs = shm_hdi;
    krhditable->lHDICnt = shm_hdi->lHDIDefCnt;
    krhditable->ptHDITable = \
      kr_hashtable_new_full(kr_long_hash, kr_long_equal, \
                            NULL, (KRDestroyNotify )kr_hdi_destruct);
    
    int i = 0;
    T_KRHDI *krhdi = NULL;
    for (i=0; i<shm_hdi->lHDIDefCnt; ++i) {
        krhdi = kr_hdi_construct(&shm_hdi->stShmHDIDef[i], datamodule);
        if (krhdi == NULL) {
            KR_LOG(KR_LOGERROR, "kr_hdi_construct [%d] failed!", i);
            kr_hashtable_destroy(krhditable->ptHDITable);
            kr_free(krhditable);
            return NULL;
        }
        kr_hashtable_insert(krhditable->ptHDITable, &krhdi->lHDIId, krhdi);
    }
    krhditable->tConstructTime = shm_hdi->tLastLoadTime;
    
    return krhditable;    
}
Пример #5
0
/* destroy this krset */
void kr_hashset_destroy(T_KRHashSet *krset)
{
    if (krset != NULL) {
        kr_hashtable_destroy(krset->set);
        kr_free(krset->name);
        kr_free(krset); krset=NULL;
    }
}
Пример #6
0
void kr_data_item_ddi_free(void *priv) 
{
    T_KRDdi *ptDdi = (T_KRDdi *)priv;
    if (ptDdi != NULL) {
        kr_calc_destruct(ptDdi->ptFilterCalc);
        kr_calc_destruct(ptDdi->ptResultCalc);
        kr_hashtable_destroy(ptDdi->ptRelated);
        kr_free(ptDdi);
    }
}
Пример #7
0
void kr_drop_table_index(T_KRIndex *krindex, T_KRTable *krtable)
{
    /* here we just destroy the hashtable of table-index, 
     * since the hashtable of db-index cross tables, 
     * we will destroy that in function kr_drop_db_index 
     */
    kr_list_remove(krtable->pIndexList, krindex); 
    if (krindex->eIndexType == KR_INDEXTYPE_TABLE) {
        kr_hashtable_destroy(krindex->pHashTable);
        kr_free(krindex);
    }
}
Пример #8
0
void kr_drop_db_index(T_KRIndex *krindex, T_KRDB *krdb)
{
    kr_list_remove(krdb->pIndexList, krindex);
    kr_hashtable_destroy(krindex->pHashTable);
    kr_free(krindex);
}
Пример #9
0
void kr_hdi_table_destruct(T_KRHDITable *ptHdiTable)
{
    kr_hashtable_destroy(ptHdiTable->ptHDITable);
    kr_free(ptHdiTable);
}
Пример #10
0
void kr_ddi_table_destruct(T_KRDDITable *ptDdiTable)
{
    kr_hashtable_destroy(ptDdiTable->ptDDITable);
    kr_free(ptDdiTable);
}
Пример #11
0
void kr_ddi_destruct(T_KRDDI *ptDDI)
{
    kr_hashtable_destroy(ptDDI->ptRelated);
    kr_calc_destruct(ptDDI->ptDDICalc);
    kr_free(ptDDI);
}
Пример #12
0
void kr_hdi_table_destruct(T_KRHDITable *krhditable)
{
    kr_hashtable_destroy(krhditable->ptHDITable);
    kr_free(krhditable);
}