On 3/6/07, Piotr Pokora <[EMAIL PROTECTED]> wrote:
>
> Hi!
>
> <code>
> GdaParameterList *paramlist = gda_parameter_list_new (NULL);
> param = gda_parameter_new_string ("name", table_name);
> gda_parameter_list_add_param (paramlist, param);
>
> GdaDataModel *dm_schema = gda_connection_get_schema (cnc,
> GDA_CONNECTION_SCHEMA_FIELDS,
> paramlist, &error);
>
> cols = gda_data_model_get_n_columns (dm_schema);
> </code>
>
> Problem is that cols is always 10 ( using MySQL provider ).
The GDA_CONNECTION_SCHEMA_FIELDS will _always_ return a GdaDataModel
containing 10 columns (described in the doc: see
,gda_connection_get_schema() and checked everytime). You probably want
to have a look at the number of rows...
> How should I create parameter list for the given schema model?
It should work if you look at the rows. Use gda_data_model_dump () for
testing purposes.
>
> All I need is to find column name.
> gda_data_model_get_column_index_by_name returns wrong values in such case
> as GdaDataModel is incorrectly initialized for this purpose.
>
The column name (that is the name of each column of a table) is in the
1st column of the returned data model (col. 0).
Cheers,
Vivien
_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list