more cleanup.

pull/23/head
kay.one 12 years ago
parent ea4f0dbe5f
commit b6fc731db8

@ -55,17 +55,7 @@ namespace NzbDrone.Core.Datastore
public TModel Get(int id) public TModel Get(int id)
{ {
try return _dataMapper.Query<TModel>().Single(c => c.Id == id);
{
var c = _dataMapper.Query<TModel>().FromTable(typeof(TModel).Name);
return null;
}
catch (ArgumentNullException e)
{
throw new InvalidOperationException(e.Message);
}
} }
@ -161,7 +151,7 @@ namespace NzbDrone.Core.Datastore
throw new InvalidOperationException("Attempted to updated model without ID"); 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);
} }
} }
} }

@ -1,5 +1,4 @@
using System; using System;
using System.Data;
using Marr.Data; using Marr.Data;
using Mono.Data.Sqlite; using Mono.Data.Sqlite;
using NzbDrone.Core.Datastore.Migration.Framework; using NzbDrone.Core.Datastore.Migration.Framework;
@ -27,7 +26,10 @@ namespace NzbDrone.Core.Datastore
var connectionString = GetConnectionString(dbPath); var connectionString = GetConnectionString(dbPath);
_migrationController.MigrateToLatest(connectionString, migrationType); _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); return new Database(dataMapper);
} }

@ -33,7 +33,7 @@ namespace NzbDrone.Core.Jobs
public IList<JobDefinition> GetPendingJobs() public IList<JobDefinition> 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() public void Init()

Loading…
Cancel
Save