Re: [gnome-db] gda_column_get_primary_key()



On Tue, 2008-12-23 at 12:29 +0100, Vivien Malerba wrote:
> 
> 
> 2008/12/21 Murray Cumming <murrayc murrayc com>
>         On Fri, 2008-11-21 at 10:20 +0100, Vivien Malerba wrote:
>         > Each field is represented as a GdaMetaTableColumn structure,
>         the
>         > is-primary-key property corresponds to the
>         GdaMetaTableColumn.pkey
>         > value,
>         > or, in case you have a multiple fields PK, then all the PK
>         fields are
>         > listed
>         > in the GdaMetaTable.pk_cols_array attribute.
>         
>         
>         So why can't this be a simple get/set function on GdaColumn,
>         http://library.gnome.org/devel/libgda/unstable/GdaColumn.html
>         
>         like it was in libgda-3.0?
>         http://library.gnome.org/devel/libgda/stable/GdaColumn.html#gda-column-get-primary-key
> 
> When inspecting the properties of a table, you don't always have a
> GdaColumn.

But if you do, it's nice if you can call get_primary_key() on that
GdaColumn. I understand that you also want a way to do it without a
GdaColumn, of course.

>  Moreover when you have a GdaDataModel (resulting from executing a
> SELECT), then the Primary key attribute of a column can lead to mis
> interpretations (for example it could mean that the column could be
> considered as a PK for the data in the data model, or it could be that
> the corresponding column was effectively part of a PK constraint).

So you could make this clearer in the API, with a gboolean& is_whole_pk
output parameter.

>  So basically one had to run a "SELECT * FROM table" to reliably get
> the PK columns of a table which is not a good wy of proceeding.

It would be simpler just to document the function as only being accurate
if the meta store has been updated.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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