Re: [gnome-db] Getting table schemea fields in libgda 0.8.105

On Tue, 2002-03-19 at 12:28, Daniel Morgan wrote:
> Is the function gda_recordset_describe_column supposed to be private and
> not to be seen by a gda client program?
yes, it's private, because it is the implementation of the virtual
method defined in its base class, GdaDataModel. So, to access that
function, you just have to call gda_data_model_describe_column for a

> Since we are using data models, I thought I would try using
> gda_connect_get_schema.
> I tried writing a function to get the table schema, but it does not
> work.  What is the best way for a client application to get meta data
> about table columns? column name, defined size, scale, nullable?
with the GDA_CONNECTION_SCHEMA_FIELDS, but there is some f***g bug lying
around which I could not find last night. It is somewhere in the
GdaParameter's management.

> Below, I have provided the source to my function to get the table schema
> and return it as a GdaDataModel.
> GdaDataModel* get_table_schema(GdaConnection *cnc, gchar *table_name)
> {
> 	GdaParameterList * parm_list;
> 	GdaParameter * parm;
> 	GdaDataModel * model;
> 	GdaValue * value;	
> 	if(!cnc)
> 		return NULL;
> 	if(!table_name)
> 		return NULL;
> 	parm_list = gda_parameter_list_new();
> 	parm = gda_parameter_new("name", GDA_VALUE_TYPE_STRING);
> 	value = gda_value_new_string(table_name);
> 	gda_parameter_set_value(parm, value);
you can use instead:

	parm = gda_parameter_new_string ("name", table_name);

> 	gda_parameter_list_add_parameter(parm_list, parm);
> 	model = gda_connection_get_schema (cnc, 
> 	gda_value_free(value);
> 	gda_parameter_free(parm);
> 	gda_parameter_list_free(parm_list);
> 	return model;
> }
your code looks ok. As I said, the problem is in the parameter

Rodrigo Moya <rodrigo gnome-db org> - <rodrigo ximian com> -

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