2008/9/1 paragasu <[EMAIL PROTECTED]>:
> i am very new into this gtk and libgnomedb. this is my first attempt

Please post to the Gnome-Db list if your post is about Gnome-DB.

> write one, i have one
> function.
>
> [snip]
> GtkWidget *page_1(GdaConnection *conn)
> {
>        GtkWidget *vbox;
>        GdaQuery *query;
>        GdaDict *dict = gda_dict_new();
>        gda_dict_set_connection(dict, conn);
>
>        query = gda_query_new_from_sql(dict, "SELECT * FROM account", NULL);
>        GdaDataModel *acc_list_model = gda_data_model_query_new(query);
>        g_object_unref(query);
>
>        query = gda_query_new_from_sql(dict,
>                        "SELECT * from account"
>                        "WHERE acc_id=##/*name=:'acc_id' type:gint 
> descr:'account id'*/",
>                        NULL);
>
>        GdaDataModel *payment_model = gda_data_model_query_new(query);
>        g_object_unref(query);
>
>        GdaParameterList *params =
> gda_data_model_query_get_parameter_list(GDA_DATA_MODEL_QUERY(payment_model));
>        GdaParameter *param = gda_parameter_list_find_param(params, "acc_id");
>
>
>    GtkWidget *grid = gnome_db_raw_grid_new(acc_list_model);
>        GtkWidget *form = gnome_db_raw_form_new(payment_model);
>
>        gtk_box_pack_start(GTK_BOX(vbox), grid, FALSE, FALSE, 3);
>        gtk_container_add(GTK_CONTAINER(vbox), form);
>
>        return vbox;
> }
>
> [/snip]
>
> the code compile well. except it give up warning  and segmentation fault.
>
> WARNING **: could  expand 'account.*' into list of fields

The (hidden and not obvious) reason is that the dictionary you use is
not up to date with the database structure, and specifically it knows
nothing about the "account" table. To solve this you can either make
sure the dictionary is up to date (use
gda_dict_update_dbms_meta_data()), or you can simlply re-write your
code and replace the '*' from "SELECT *..."  with the actual fields to
select.

BTW, if you are starting with the library on new code, I strongly
encourage you to use the last 3.99.x version as its API is far easier
to use and less buggy (the only disadvantage is that the API is not
yet stable but mostly).

Regards,

Vivien
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to