Changeset 16368

Show
Ignore:
Timestamp:
05/12/08 16:08:58 (5 months ago)
Author:
piotras
Message:

Removed QB ML fallback computation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/branch-1-8/src/core/midgard/src/query_builder.c

    r16365 r16368  
    526526        MidgardQueryBuilder *builder, MidgardTypeHolder *holder, guint select_type) 
    527527{ 
    528         g_assert(builder); 
    529          
    530         GList *tmp_list = NULL; 
     528        g_assert(builder != NULL);  
    531529         
    532530        GList *list = _mqb_set_object_from_query(builder, select_type); 
     
    537535        } 
    538536 
    539         if (builder->schema->use_lang == 1) { 
    540                  
    541                 gchar *guid = NULL; 
    542                 GList *nlist = NULL; 
    543                  
    544                 if((midgard_lang_get(builder->mgd) != 0) 
    545                                 && builder->lang == -1) 
    546                         list = g_list_reverse(list); 
    547  
    548                 for(; list ; list = list->next){      
    549                         
    550                         /* Bit of hack, records could be returned with lang DESC */ 
    551                          
    552                         if(select_type == MQB_SELECT_OBJECT) { 
    553                                 g_object_get(G_OBJECT(list->data), "guid", &guid, NULL); 
    554                         } else if (select_type == MQB_SELECT_GUID) { 
    555                                 guid = g_strdup((gchar *)list->data); 
    556                         } 
    557                         /* Changed to find_custom due to bug in GLib docs */ 
    558                         /* g_list_find never returns NULL */ 
    559                         /* We could use g_hash_table as well */ 
    560                         if((tmp_list = g_list_find_custom(tmp_list,  
    561                                                 guid, _compare_ml_guid))) { 
    562                                  
    563                                 g_free((gchar *)tmp_list->data);   
    564                                 tmp_list->data = g_strdup(""); /* FIXME */ 
    565                                  
    566                                 if(select_type == MQB_SELECT_OBJECT) { 
    567                                         g_object_unref(G_OBJECT(list->data)); 
    568                                 } else if (select_type == MQB_SELECT_GUID) { 
    569                                         /* TODO check leak, none for now */ 
    570                                         /* g_free(list->data); */ 
    571                                 } 
    572                                  
    573                         } else { 
    574                                 nlist = g_list_append(nlist, list->data);                           
    575                         }        
    576                         tmp_list = g_list_prepend(tmp_list, (gpointer)guid); 
    577                 }           
    578                  
    579                 /* Free unused guids */ 
    580                 for(; tmp_list ; tmp_list = tmp_list->next){ 
    581                         g_free((gchar *)tmp_list->data); 
    582                 } 
    583                 g_list_free(tmp_list); 
    584                 g_list_free(list); 
    585                 list = nlist; 
    586         }     
    587          
    588537        if(holder) 
    589538                holder->elements = g_list_length(list);     
    590  
    591         /* We reverte order to its initial state */ 
    592         if((midgard_lang_get(builder->mgd) != 0) 
    593                         && builder->lang == -1) 
    594                 list = g_list_reverse(list); 
    595539 
    596540        return list;