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



Is the function gda_recordset_describe_column supposed to be private and
not to be seen by a gda client program?

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?

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);

	gda_parameter_list_add_parameter(parm_list, parm);

	model = gda_connection_get_schema (cnc, 
			GDA_CONNECTION_SCHEMA_FIELDS, parm_list);
	
	gda_value_free(value);
	gda_parameter_free(parm);
	gda_parameter_list_free(parm_list);

	return model;
}






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