Hi,
I think i found a bug in GdaDataModelHash. The libgda version that i am using 
is 3.0. The following gives error. However after patching with the attahced 
file, the error goes away.

---------------- code snippet ------------------
#include <stdio.h>
#include <libgda/libgda.h>
#define NOERROR 0
#define ERROR 1

int main()
{
        int retVal = NOERROR;

        gda_init ("TestGDA", NULL, 0, NULL);

        GdaDataModelHash *hash_model = (GdaDataModelHash 
*)gda_data_model_hash_new(2);

        if(!hash_model)
        {
                retVal = ERROR;
        }

        GValue *value = NULL;
    GList *list = NULL;

    g_value_set_int(value = gda_value_new(G_TYPE_INT),10);
    list = g_list_append(list,value);

    g_value_set_string(value = gda_value_new(G_TYPE_STRING),"test");
    list = g_list_append(list,value);

    gda_data_model_append_values(GDA_DATA_MODEL(hash_model),list,NULL);

    g_list_foreach(list,(GFunc)gda_value_free,NULL);
    g_list_free(list);

    list = NULL;

g_value_set_int(value = gda_value_new(G_TYPE_INT),11);
    list = g_list_append(list,value);

    g_value_set_string(value = gda_value_new(G_TYPE_STRING),"test1");
    list = g_list_append(list,value);

    gda_data_model_append_values(GDA_DATA_MODEL(hash_model),list,NULL);

    g_list_foreach(list,(GFunc)gda_value_free,NULL);
    g_list_free(list);

    const GValue *val1 = 
gda_data_model_get_value_at(GDA_DATA_MODEL(hash_model),0,0);

    if(!val1)
    {
        retVal = ERROR;
    }

    int no = g_value_get_int(val1);

    if(no != 10)
    {
        retVal = ERROR;
    }

end:

        g_object_unref(G_OBJECT(hash_model));
        return retVal;
}


---------------- End code snippet ------------------

 
Regards,
Sumit
 
Sumit Kumar Jain
Call me: +91-9880472974





      Get the freedom to save as many mails as you wish. To know how, go to 
http://help.yahoo.com/l/in/yahoo/mail/yahoomail/tools/tools-08.html

Attachment: patch-gda-data-model-hash.patch
Description: Binary data

_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Reply via email to