Re: [gnome-db] GdaSqlBuilder: IDs

On 17 May 2010 15:34, Murray Cumming <murrayc murrayc com> wrote:
> I have some general thoughts about the IDs used with the GdaSqlBuilder
> functions:
> 1.
> I think we should have a GdaSqlBuilderID typedef. That will make things
> easier if this type is every more complex in some future API-breaking
> version of libgda. This would not break code that currently uses guint.

I really don't envision other things than guint as they are only an
index into internal objects, so I don't think it's necessary.

> 2.
> Some functions allow you to specify the value of the ID that will be
> returned, though you can leave it as 0 to make it auto-generated.
> For instance, gda_sql_builder_add_cond()
> However,
> 2.1.
> This adds an extra parameter, making the API more complicated,
> particularly when there are other parameters of exactly the same type,
> 2.2
> This encourages application developers to use "magic numbers" in their
> code, making the code fragile and obscure. I don't like seeing
> parameters like "5, 1, 2" in code, but I don't mind
> "field_id, value_id".
> For this reason, I hide these parameters in libgdamm (The C++ binding).
> Application code then just saves the return values in temporary
> variables, whose names make the code clearer.

Yes, you're right. Specifying an ID to be used (instead of letting the
sql builder object assign one) should be removed. If you have the time
to do it, that's better as I don't have much time at the moment to
work on this.  Otherwise I'll do it ASAP.


> --
> murrayc murrayc com
> _______________________________________________
> gnome-db-list mailing list
> gnome-db-list gnome org

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