Re: [gnome-db] gda_data_model_update_row syntax
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Paisa Seeluangsawat <paisa unt edu>
- Cc: GDA <gnome-db-list gnome org>
- Subject: Re: [gnome-db] gda_data_model_update_row syntax
- Date: Thu, 16 Oct 2003 11:44:05 +0200
On Wed, 2003-10-15 at 03:32, Paisa Seeluangsawat wrote:
> > looks good, although I would improve it in a way that there is a status
> > on the row. That is, we can have a 'updatable' field on GdaRow, and when
> > you call get_upodatable_row, that flag is set to TRUE (being FALSE in
> > all other cases). Thus, providers can mark the rows that can be updated.
> >
> > Also, I dont think we need the get_uopdatable_value function, since the
> > updatable values will be the ones contained in the updatable rows
> > returned by get_updatable_row.
> >
> > cheers
>
> If we have only one get_value() for both type of GdaRow*, what should
> the return type be? Returning 'GdaValue*' will create a burden
> (either on us or the users) of remembering which GdaValue* instances
> are updatable and which are not. Returning 'const GdaValue*' will
> force the users to cast off "const" from updatable instance--not a
> good API. I want to avoid having yet function for users to remember.
> But lacking operator overloading, I don't see how to avoid it.
>
I've been thinking that the best thing would be probably to remove the
const in all those functions, and clearly specify, in the API
documentation, which values CANNOT be freed by the caller. That would
remove all this cruft we've got because of those 'const'.
> I also don't see who the intended user of the new 'updatable' field
> is. My rationale is,
>
> - The users don't need it. They know 'Gda[Row|Value] *' are
> updatable, and the const ones are not.
>
right, they know they are updatable or not based on the data model that
contain them (gda_data_model_is_editable). So, we can safely not use at
all that 'updatable' field.
> - The library don't need it. gda_value_set_int() and friends take
> only 'const GdaValue*', which prevent users from unknowingly
> setting non-updatable instances. If the user cast off 'const',
> s/he intentionally want to screw up. There's little point for the
> library to check 'updatable' field and stopping it.
>
well, we need to not allow users to change GdaValue's contained in
non-updatable recordsets, so we really need a way to prevent this, since
the values returned to the user are pointers to the internally stored
values in the data model.
So, either we add code to the library to prevent changing the values, or
return copies of the values to the caller.
Anyone else has any comments?
cheers
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]