Re: [gnome-db] gda_data_model_update_row syntax



> well, the updatable models implementation is totally left to the
> provider. It should be hidden to clients, and each provider would use
> whatever best is for it to do the job. Clients would just use
> gda_data_model_*.

That, I agree.

Anyway, my proposal was about expected usage of gda_data_model_* in
order to update a row.  I proposed using 'const' to tell whether
GdaRow or GdaValue are updatable, with the following modification to
the API,

  - add/delete 'const' from several existing functions

  - add gda_data_model_get_updatable_row() and
    gda_row_get_updatable_value().  These functions will be pure
    virtual (in your word's: totally left to the provider).  The user
    just need them to behave the same.  And I proposed a guideline in
    [1].

The read syntax is exactly the same as before--except that now there's
no more ugly const casting.  The write syntax becomes,

  // Given:  model, row_no, col_no, lock_type;
  gint lock_result;
  GdaRow *row = gda_data_model_get_updatable_row (model, row_no,
				lock_type, &lock_result);

  if (lock_result < 0)  return error ("Can't update");
  GdaValue *value = gda_row_get_updatable_value (row, col_no);
  gda_value_set_string (value, "new value");
  gda_data_model_update_row (model, row);


This interface gives providers a lot of implementation
flexibility--including whether to use updatable cursor or update
command.  May I implement it?

Paisa


[1] http://mail.gnome.org/archives/gnome-db-list/2003-October/msg00026.html





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