On 3/1/07, Armin Burgmeier <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Vivien Malerba wrote:
> > However I doubt it will be very usefull: the data returned from a
> > SELECT command can now be edited (in most if not all the cases since
> > the provider's own implementations of the returned data model inherits
> > GdaDataModelHash) but it won't actually write back the modifications
> > to the database for the simple reason that in most cases it won't know
> > what to write, so the modified data cannot be used (except in some are
> > cases).
>
> I am fully aware of this (although other providers seem to have code to
> write data back to the database, but I have not tested it).

I'm aware of that feature and I don't like it as it's not clear when a
returned data model is updatable and when it's not. However it could
be improved as the GdaDataModel interface has a i_get_attributes_at()
virtual method which allows actual implementations to return the
"writability" of a specific value (which is used extensively in the
GdaDataModelQuery object). So a good work would be to update the
various providers' GdaDataModel implementations to return very
accurate values for this method.

>
> Thing is that the GnomeDbGrid (and probably the form, too) already allow
> modifications to the data even without this patch (this actually was why
> I thought it should work), but fails when hitting the commit button.
> Perhaps, an easier and more correct solution is to override is_updatable
> in GdaSqliteRecordset and/or setting the read-only property to TRUE, so
> that the GnomeDbGrid does just not allow editing the data.

Yes, or even better implement correctly the i_get_attributes_at()
virtual method.

>
> > What I believe is better is to create a GdaDataModelQuery data model
> > for which you'll give a SELECT query, and optionnally INSERT, UPDATE
> > or DELETE queries so it knows how to actually write the data you
> > modify back to the database.
>
> This technique is already used in the more advanced examples. I just
> want to show something working with libgnomedb with as less code as
> possible.

Ok.

Thanks again,

Vivien
_______________________________________________
gnome-db-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-db-list

Reply via email to