Re: [gnome-db] gda_data_model_update_row syntax
- From: Paisa Seeluangsawat <paisa unt edu>
- To: GDA <gnome-db-list gnome org>
- Subject: Re: [gnome-db] gda_data_model_update_row syntax
- Date: Tue, 14 Oct 2003 02:24:58 -0500
Regarding to "the ability to update a row", this is probably what
gda_data_model_is_editable() is for.
I agree with moving provider specific functions into a separate
header. This will also help tidy up the documentation a bit, since
regular users shouldn't have to care about these functions.
To prevent forcing user to cast off "const", I think we can provide
separate functions for editing. As added benefits, it allows
providers to do special preparation, such as row locking or copying
the original record values.
A draft idea follows. Comment please :-),
Paisa
const GdaRow* gda_data_model_get_row (GdaDataModel *model, gint row);
GdaRow* gda_data_model_get_updateable_row (
GdaDataModel *model, gint row,
LockType lock_type, LockType *result);
// the following two can be overloaded in most languages binding
const GdaValue* gda_row_get_value (const GdaRow *row, gint num);
GdaValue* gda_row_get_updatable_value (GdaRow *row, gint num);
enum LockType {
NO_LOCK = 0;
REFRESH;
LOCK_ROW; // default
LOCK_TABLE; // use this with caution
CONFLICT = -2;
NONEDITABLE = -1;
};
GdaRow *
gda_data_model_get_updateable_row (GdaDataModel *model, gint row,
LockType lock_type, LockType *result)
{
if (model can't be edited)
result = NONEDITABLE;
return NULL;
result = lock_type;
if (result == LOCK_ROW)
if (provider support row locking)
lock the row;
if (succeed)
reselect the row to make sure the
content is uptodate;
else
result = CONFLICT;
return NULL;
else
result = REFRESH;
if (result == LOCK_TABLE)
similar to above;
if (result == REFRESH)
reselect the row data;
return GdaRow*
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]