Re: [gnome-db] libgnomedb: data validation



On Fri, 2006-12-01 at 10:37 +0100, Vivien Malerba wrote:
> For numerical values, the individual cell renderers used in a grid, or
> the data entry widgets used in a form will let you enter any
> character, but the returned value is the same as if you used the
> atoi() family functions.
> 
> The current implementation does not let you do any specific formatting
> nor any specific control. However there is only some code to add to
> make this possible, there is no infrastructure to change, in fact this
> is already done for the existing plugins within libgnomedb.

I'm not sure what you mean by plugins here. Links to viewcvs might help
me understand.

>  More
> specifically, have a look at the gnome_db_util_new_cell_renderer() and
> related functions in the gnome-db-tools.c file (for example for the
> GnomeDbEntryPict plugin, which definition files are in
> data-entries/plugins/).
> 
> >
> > How does the UI behave if the database server rejects the data?
> >
> 
> The problem is more generic than that, because a grid may display data
> which is not related to something in a database. In fact the grid
> widget just displays what's in its proxy (created on top of the
> GdaDataModel which contains data to display). So the answer is that
> the behaviour of the grid (or form for that matter) is the same as the
> GdaDataProxy object.

But this GdaDataProxy is not something that the application developer
sees, right? I mean, it's not public API?

> Specifically to the situation you mention, the GdaDataModel to display
> must be a GdaDataModelQuery object.

Which is returned from gda_connection_execute_select_command(), right?

>  Here is what happens when the user
> wants to apply the changes made:
> 1- the GdaDataProxy sends the GDA_DATA_MODEL_HINT_START_BATCH_UPDATE
> hint to tell that it will make several modifications at once
> 2- the GdaDataProxy tries to apply the changes for each row which has
> been modified, and stops as soon as a change is refused by the
> GdaDataModelQuery
> 3- upon asked to do a change, the GdaDataModelQuery tries to run the
> pre-defined modification query and returns the success status of that
> query. It also flags itself for a future re-run of its SELECT query to
> refresh its contents
> 4- he GdaDataProxy sends the GDA_DATA_MODEL_HINT_END_BATCH_UPDATE
> hint, and the GdaDataModelQuery re-runs its SELECT query (which makes
> it change its contents which are propagated up to the grid itself)
> 
> So the displayed data is always a re-run of the SELECT query of the
> GdaDataModelQuery object.

So, if the UPDATE fails then the new (failed) value will just be
refreshed with the old value in the UI, with no message to the user and
no chance to retry?

> Sorry for my long answer but I prefer to give more details...

No, this is good. Thanks.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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