Re: [gnome-db] GdauiDataStore gives incorrect values



Hello,

I’m using 5.1.2 from the Fedora 20 repository.

I have a function ag_db_select(), which returns a GdaDataModel *. Here
is an exerpt of my actual code:

    {
        GdauiDataStore *store;
        GtkTreeIter    iter;

        store = GDAUI_DATA_STORE(gdaui_data_store_new(result));

        if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
            gint test_int;

            gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 0, &test_int, -1);
            g_warning("Found row: %d", test_int);
        } else {
            g_warning("No such row!");
        }
    }

    value            = gda_data_model_get_value_at(result, COLUMN_ID, 0, NULL);
    save_data->db_id = g_value_get_int(value);

This sends the warning to my terminal "Found row: 41413296", while
setting save_data->db_id to 1 (the value I expect).

To test my case, I have created a small sample as you requested. I put
it in a gist: https://gist.github.com/gergelypolonkai/760fc710b56cb6b77ea5

It produces two "Found row" warnings as expected, but the first
warning contains totally bad values for me.

Thank you in advance!

Best,
Gergely

On 31 July 2014 22:05, Vivien Malerba <vmalerba gmail com> wrote:
Hi!

It should normally work as you mention.

Can you specify which Libgda version you use, and do you have some time to
create a small code sample so I can easily reproduce it?

Regards,

Vivien


On 30 July 2014 08:37, Gergely Polonkai <gergely polonkai eu> wrote:

Hello,

I have a GdaDataModel, from which I can easily fetch data, e.g. with
gda_data_model_get_value_at(). As for an external function I need the
returned data in a struct, I tried to use GdauiDataStore:

store = gdaui_data_store_new(result);

If I get an iter to the wirst row with
gtk_tree_model_get_iter_first(store, &iter), it returns TRUE. I can query
the row number with gdaui_data_store_get_row_from_iter(), which returns 0 as
it should (I guess).

Now, if I try to fetch the ID column (first column in result, type
integer) with gtk_tree_model_get(store, &iter, 0, &test_int, -1), it puts
some really weird value in test_int instead of what I expect.

Do I miss something? According the docs that's all I should do, but it
seems not enough.

Thank you in advance!

Best,
Gergely


_______________________________________________
gnome-db-list mailing list
gnome-db-list gnome org
https://mail.gnome.org/mailman/listinfo/gnome-db-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]