~ubuntu-branches/ubuntu/trusty/banshee/trusty-updates

« back to all changes in this revision

Viewing changes to src/Hyena/Hyena.Data.Sqlite/Hyena.Data.Sqlite/SqliteModelProvider.cs

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-02-09 23:06:03 UTC
  • mfrom: (1.2.26) (150.1.2 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20140209230603-7dhbveo058j96ea0
* [fbf05ca] Imported Upstream version 2.9.0+really2.6.1:
  Downgrade to 2.6.1 -- 2.9.x is unstable and 3.0 won't arrive in time for
  release
* [22de440] Revert packaging to 2.6.1-2ubuntu1
* [7357b73] Merge changes from 2.6.1-5
* [a7156c0] Filter out libgpod-cil-dev versions built against gtk#3
* [e7c634d] Update dversionmangle for extracting +really version out

Show diffs side-by-side

added added

removed removed

Lines of Context:
262
262
                        "Multiple primary keys in the {0} table", TableName)
263
263
                    );
264
264
                }
265
 
                if (!c.ValueType.IsAssignableFrom (typeof (long))) {
266
 
                    throw new Exception (String.Format (
267
 
                        "Primary key {0} in the {1} class must be of type 'long'", c.Name, typeof(T))
268
 
                    );
269
 
                }
270
265
                key = c;
271
266
            }
272
267
        }
295
290
        public virtual void Save (T target, bool force_insert)
296
291
        {
297
292
            try {
298
 
                if (Convert.ToInt64 (key.GetRawValue (target)) > 0 && !force_insert) {
 
293
                if (Convert.ToInt32 (key.GetRawValue (target)) > 0 && !force_insert) {
299
294
                    Update (target);
300
295
                } else {
301
296
                    key.SetValue (target, Insert (target));
327
322
            return values;
328
323
        }
329
324
 
330
 
        protected long Insert (T target)
 
325
        protected int Insert (T target)
331
326
        {
332
327
            return connection.Execute (InsertCommand, GetInsertParams (target));
333
328
        }
483
478
            if (key == null || item == null)
484
479
                return false;
485
480
 
486
 
            long id = (long) key.GetValue (item);
 
481
            int id = (int) key.GetValue (item);
487
482
            if (id < 1)
488
483
                return false;
489
484