[gnome-db] GdaSqlBuilder: IDs



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.


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()
http://library.gnome.org/devel/libgda/unstable/GdaSqlBuilder.html#gda-sql-builder-select-add-target

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.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



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