Re: [gnome-db] create/drop table.
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: bas driessen xobas com
- Cc: GNOME-DB List <gnome-db-list gnome org>
- Subject: Re: [gnome-db] create/drop table.
- Date: Wed, 26 Jan 2005 12:42:48 +0100
On Wed, 2005-01-26 at 20:28 +1000, Bas Driessen wrote:
> Hello,
>
> The next area that I am looking at to get to work for both PostgreSQL
> as MySQL is "gda_connection_create_table" and
> "gda_connection_drop_table". The drop table is pretty straight forward
> and have that working. The create table is also not that difficult to
> make, but I have a question regarding the arguments. Currently the
> following function call is documented:
>
> gboolean gda_connection_create_table (GdaConnection *cnc,
> const gchar *table_name,
> const
> GdaDataModelColumnAttributes *attributes[]);
>
> Regarding the last parameters. Why don't we use a type of GPtrArray or
> GList here?
>
makes sense, although it forces callers to create the array/list, fill
it in, and then free it.
> It would be more consistent with the rest of libgda, since this
> "plain" array type is used nowhere in the product.
>
that's a good reason, I would vote for a GList, which is easier to fill
in.
> Also, how can we otherwise determine the length? Maybe I have go back
> to C programming lesson 1, but if the user does not supply a NULL
> terminated array, we may run into problems. Any ideas/comments?
>
you can use G_N_ELEMENTS, which just does a -> sizeof (attributes) /
sizeof (attributes[0])
> Also, we probably need a gda_connection_create_index (and drop) for
> compound keys. How would those arguments look like, since
> GdaDataModelColumnAttributes is not a good structure to place them in.
> Any ideas/thoughts in this area?
>
we have the is_key/is_unique fields in GdaColumnAttributes, so callers
can just set all fields that are part of the key accordingly and the
provider would just need to create, from that information, the indices.
I know it's more complicated for the provider, but it avoids one extra
call from the clients.
Apart from that, it makes sense to have the create/drop_index functions,
for other uses, so, if you want, add them. Only take into account that
those API additions can only be committed to HEAD, not to the 1.2.x
branch.
--
Rodrigo Moya <rodrigo gnome-db org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]