Re: [gnome-db] GdaDataModel and column introspection





On 30 January 2012 18:41, Piotr Pokora <piotrek pokora gmail com> wrote:

Hi!

I have a simple query:
SELECT p.firstname AS name, p.lastname AS lastname FROM person AS p;

Why both functions:
gda_data_model_get_column_name
gda_data_model_get_column_title

return the same value?

For 'p.firstname AS name' both return 'name'.

Also, how can I get qualifier name, field name and as parts used in query?

gda_data_model_describe_column seems to be good choice but none of its
method returns those.

The gda_data_model_get_column_name() and gda_data_model_get_column_title()  are merely wrappers around the gda_data_model_describe_column() function.

AFAIK no API returns the results you want. What Libgda could do is map each returned column to a  GdaStatement _expression_ if the statement executed is a SELECT. In your example the 1st column could be mapped to the _expression_ "p.firstname AS name".  Then it would be possible to add more attributes to the GdaColumn, the ones you want (i.e. the field name queried for example).

Regards,

Vivien


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