From b6fc731db8cc29c9d3069e66a56073911118a758 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 25 Mar 2013 00:36:22 -0700 Subject: [PATCH] more cleanup. --- NzbDrone.Core/Datastore/BasicRepository.cs | 14 ++------------ NzbDrone.Core/Datastore/DbFactory.cs | 6 ++++-- NzbDrone.Core/Jobs/JobRepository.cs | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/NzbDrone.Core/Datastore/BasicRepository.cs b/NzbDrone.Core/Datastore/BasicRepository.cs index a6112c81c..11d6270f9 100644 --- a/NzbDrone.Core/Datastore/BasicRepository.cs +++ b/NzbDrone.Core/Datastore/BasicRepository.cs @@ -55,17 +55,7 @@ namespace NzbDrone.Core.Datastore public TModel Get(int id) { - try - { - var c = _dataMapper.Query().FromTable(typeof(TModel).Name); - - return null; - } - catch (ArgumentNullException e) - { - throw new InvalidOperationException(e.Message); - } - + return _dataMapper.Query().Single(c => c.Id == id); } @@ -161,7 +151,7 @@ namespace NzbDrone.Core.Datastore throw new InvalidOperationException("Attempted to updated model without ID"); } - // _database.UpdateOnly(model, onlyFields, m => m.Id == model.Id); + // _database.UpdateOnly(model, onlyFields, m => m.Id == model.Id); } } } diff --git a/NzbDrone.Core/Datastore/DbFactory.cs b/NzbDrone.Core/Datastore/DbFactory.cs index bcd2b441f..1de2122d3 100644 --- a/NzbDrone.Core/Datastore/DbFactory.cs +++ b/NzbDrone.Core/Datastore/DbFactory.cs @@ -1,5 +1,4 @@ using System; -using System.Data; using Marr.Data; using Mono.Data.Sqlite; using NzbDrone.Core.Datastore.Migration.Framework; @@ -27,7 +26,10 @@ namespace NzbDrone.Core.Datastore var connectionString = GetConnectionString(dbPath); _migrationController.MigrateToLatest(connectionString, migrationType); - var dataMapper = new DataMapper(SqliteFactory.Instance, connectionString); + var dataMapper = new DataMapper(SqliteFactory.Instance, connectionString) + { + SqlMode = SqlModes.Text, + }; return new Database(dataMapper); } diff --git a/NzbDrone.Core/Jobs/JobRepository.cs b/NzbDrone.Core/Jobs/JobRepository.cs index 84fd565c4..5709f9c11 100644 --- a/NzbDrone.Core/Jobs/JobRepository.cs +++ b/NzbDrone.Core/Jobs/JobRepository.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Jobs public IList GetPendingJobs() { - return Queryable().Where(c => c.Enable && c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList(); + return Queryable().Where(c => c.Enable == false && c.Interval != 2).ToList().Where(c => c.LastExecution < DateTime.Now.AddMinutes(-c.Interval)).ToList(); } public void Init()