[gnome-db] Multi column indexes.



Hello,

I would like to implement the ability to create multi column indexes in
libgda through the API. I don't believe it is a good idea to expand the
structure GdaDataModelColumnAttributes to cater for this. Also it will
be complex to do so as it is a multi level situation. Therefore I have
come up with the following idea. Let's use this as a starting point for
discussion and let me know what you think:


typedef enum {
	ASCENDING,
	DESCENDING
} GdaSorting;	


struct GdaDataModelIndexAttributes {

  gchar *column_name;
  gint size;
  GdaSorting sorting;
  gchar *col_references;
};


struct GdaDataModelIndex {

  gchar *name;
  gchar *table_name;
  gboolean primary_index;
  gboolean unique_index;
  gchar *idx_references;
  GList *index_attr_list; /* list of GdaDataModelIndexAttributes */
};
  
This will cater for the basics and we can create statements like:

CREATE UNIQUE INDEX title_idx ON films (title);

CREATE INDEX part_of_name ON customer (last_name,first_name DESC);

CREATE INDEX part_of_name ON customer (name(10));

etc etc

Also, do we want a separate "create_index" method or pass on an extra
parameter to the "create_table" method or do both?

Please respond. If you have other/better ideas/suggestions or if you
think some basics are missing, let me know.

Thanks,
Bas.







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