Re: [gnome-db] gda_column_get_primary_key()





2008/11/18 Murray Cumming <murrayc murrayc com>
On Mon, 2008-11-17 at 14:08 +0100, Vivien Malerba wrote:
>
>
> 2008/11/17 Johannes Schmid <jhs jsschmid de>
>         Hi!
>
>         There is nothing predefined for gda_column_get_attribute for
>         the
>         primary_key property that was available in v3. How can I get
>         this?
>
> It has been removed because:
> * having a column marked PK in a data model did not mean the column
> would be unique and not null in the reult set (for example if you have
> a join in the SELECT)
> * it can be time consuming to compute it.
>
> The gda_data_select_compute_columns_attributes() method computes the
> column attibutes for some of the attributes, and you can use it as an
> example of how to get the information you want.

So is it now up to applications to remember what key is the primary key
in a table? We can of course do that in Glom, though it would be nice to
have that structure information in the database too.

I mean, if a table has two unique keys, how could it guess which is
meant to be presented to the user as the primary key?

In V3 the information was available using the GdaDict object. In V4, the same information is available using the GdaMetaStruct object.

The only difference (appart from the API) is that in V3 all the dictionary had to be in memory all the time even if not used whereas in V4 only the requested part of the dictionary is loaded in memory: the dictionary itself is represented by a GdaMetaStore (which uses a DB) and an extract of the dictionary is represented as a GdaMetaStruct.

Vivien



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