After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 613981 - [Hyena] Allow force insert in SqliteModelProvider.Save ().
[Hyena] Allow force insert in SqliteModelProvider.Save ().
Status: RESOLVED FIXED
Product: banshee
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: 1.x
Assigned To: Banshee Maintainers
Banshee Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-03-26 00:43 UTC by Ruben Vermeersch
Modified: 2010-03-26 07:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Allow force insert in SqliteModelProvider.Save (). (2.29 KB, patch)
2010-03-26 00:43 UTC, Ruben Vermeersch
committed Details | Review

Description Ruben Vermeersch 2010-03-26 00:43:30 UTC
Adds a Save () overload to SqliteModelProvider which takes a second boolean
parameter to cause a forced insert.

This is needed for cases where you want to preinitialize the primary key to a
certain value. Simply calling Save () would cause the model provider to think
that this is an existing object, causing an update to happen. Result: object
not saved.

Example use case:

    private class CacheParameters
    {
        [DatabaseColumn(Constraints = DatabaseColumnConstraints.PrimaryKey)]
        public int CacheId { get; set; }

        [DatabaseColumn]
        public string Parameters { get; set; }
    }

In this class, the CacheId parameter is set to match the id of objects in
another table. Without the overload, there is no way to save it.
Comment 1 Ruben Vermeersch 2010-03-26 00:43:33 UTC
Created attachment 157131 [details] [review]
Allow force insert in SqliteModelProvider.Save ().
Comment 2 Gabriel Burt 2010-03-26 02:00:57 UTC
Review of attachment 157131 [details] [review]:

Looks good to me
Comment 3 Ruben Vermeersch 2010-03-26 07:40:59 UTC
Comment on attachment 157131 [details] [review]
Allow force insert in SqliteModelProvider.Save ().

Committed, thanks Gabriel!