Re: [gnome-db] gda_data_model_describe_column



On Tue, 9 Nov 2004 21:48:26 -0700, Neil Zanella <nzanella gmail com> wrote:
> What's the point of this method: ?
> 
> GdaFieldAttributes* gda_data_model_describe_column
>                                             (GdaDataModel *model,
>                                              gint col);
> 
> Or rahter, what's the point of returning this?
> 
> struct GdaFieldAttributes {
> 
>         gint defined_size;
>         gchar *name;
>         gchar *table;
>         gchar *caption;
>         gint scale;
>         GdaValueType gda_type;
>         gboolean allow_null;
>         gboolean primary_key;
>         gboolean unique_key;
>         gchar *references;
>         gboolean auto_increment;
>         glong auto_increment_start;
>         glong auto_increment_step;
>         gint position;
>         GdaValue *default_value;
> };
> 
> Can we change this struct. What does "gboolean unique_key;" mean? Does it mean
> the column by itself is a unique key? Make that boolean a pointer to a structure
> containing all unique key structures in which the given column participates. It
> would make more sense? A table can have more than one unique key
> composed of more than one field. Then again, struct GdaFieldAttributes
> is undocumented so it's hard to make sense of it right now. Anyways,
> please change it, cause it doesn't seem right. Do this:
> 
> struct GdaFieldAttributes {
> 
>         gint defined_size;
>         gchar *name;
>         gchar *table;
>         gchar *caption;
>         gint scale;
>         GdaValueType gda_type;
>         gboolean allow_null;
>         GdaPrimaryKey *primary_key;
>         GdaUniqueKeys **unique_keys;
>         GdaReferences **references;
>         gboolean auto_increment;
>         glong auto_increment_start;
>         glong auto_increment_step;
>         gint position;
>         GdaValue *default_value;
> };
> 

Personnaly I believe that there is too much information in that
structure: we are mixing database schema information with resultset
information; the database schema information can be retreived using
the specific schema information already provided by libgda.

I and would limit down to the same kind of information for the JDBC
ResultSetMetaData interface (see
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSetMetaData.html),
it would then become:

struct GdaFieldAttributes {
       // name and position
       gchar *name;
       gchar *label;
       gint position;

       // data type
       GdaValueType gda_type;
       gchar *dbms_type;                   <-- Real DBMS type name for
the column
       gint precision;
       gint scale;

       // optionnal
       gboolean allow_null;
       gboolean auto_increment;
       gchar *table_name;              <-- need to define exactely
when it is filled and what it means; I doubt its utility.
};

Maybe renaming that to GdaDataColumnAttributes would make its purpose
clear and without ambiguities.

Cheers,

Vivien



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