Re: libgnomedb3.0: WARNING **: could expand "" into list of field



i am sorry, maybe this email should go to gnome-db list. but, i can
help but to continue use this thread for this time.

But i come accross another problem. It compile, but now give critical error.
I try to check what is wrong and tried to search using google but
return no result. so,
again i have to ask this list to guide me the direction. Anything i
miss here, i look at the
code many times but i cannot spot the problem.

thank you again..

CRITICAL **: gda_parameter_list_find_param: assertion
`GDA_IS_PARAMETER_LIST (paramlist)` failed
CRITICAL **: gda_parameter_restrict_values: assertion
`GDA_IS_PARAMETER (param)` failed

here is the code

[code]
/*notebook page 1*/
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 acc_id, name, ic, tel
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 acc_id, name, ic from
account WHERE acc_id=##/*name=:'accountNo' type:gint*/",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, "accountNo");
        g_assert(gda_parameter_restrict_values(param, acc_list_model, 0, NULL));
        

        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;
}
[/code]

p/s: i did try to download V4-branch, but have some problem compiling
it. some of dependencies is missing on my debian lenny. i will try
again..

On 9/1/08, Vivien Malerba <vmalerba gmail com> wrote:
2008/9/1 paragasu <paragasu gmail com>:
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




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