|
|
@ -14,12 +14,14 @@ namespace NzbDrone.Core.Datastore
|
|
|
|
|
|
|
|
|
|
|
|
public class Database : IDatabase
|
|
|
|
public class Database : IDatabase
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
private readonly string _databaseName;
|
|
|
|
private readonly Func<IDataMapper> _datamapperFactory;
|
|
|
|
private readonly Func<IDataMapper> _datamapperFactory;
|
|
|
|
|
|
|
|
|
|
|
|
private readonly Logger _logger = NzbDroneLogger.GetLogger(typeof(Database));
|
|
|
|
private readonly Logger _logger = NzbDroneLogger.GetLogger(typeof(Database));
|
|
|
|
|
|
|
|
|
|
|
|
public Database(Func<IDataMapper> datamapperFactory)
|
|
|
|
public Database(string databaseName, Func<IDataMapper> datamapperFactory)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
_databaseName = databaseName;
|
|
|
|
_datamapperFactory = datamapperFactory;
|
|
|
|
_datamapperFactory = datamapperFactory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -42,9 +44,9 @@ namespace NzbDrone.Core.Datastore
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Info("Vacuuming database");
|
|
|
|
_logger.Info("Vacuuming {0} database", _databaseName);
|
|
|
|
_datamapperFactory().ExecuteNonQuery("Vacuum;");
|
|
|
|
_datamapperFactory().ExecuteNonQuery("Vacuum;");
|
|
|
|
_logger.Info("Database Compressed");
|
|
|
|
_logger.Info("{0} database compressed", _databaseName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception e)
|
|
|
|
catch (Exception e)
|
|
|
|
{
|
|
|
|
{
|
|
|
|