mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 17:44:43 +01:00
add sqlite logging
This commit is contained in:
@@ -4,12 +4,12 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Emby.Server.Core;
|
||||
using Emby.Server.Core.Data;
|
||||
using Emby.Server.Core.FFMpeg;
|
||||
using Emby.Server.Data;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.System;
|
||||
using Emby.Server.Implementations;
|
||||
|
||||
namespace Emby.Server
|
||||
{
|
||||
@@ -55,11 +55,6 @@ namespace Emby.Server
|
||||
{
|
||||
}
|
||||
|
||||
protected override IDbConnector GetDbConnector()
|
||||
{
|
||||
return new DbConnector(Logger);
|
||||
}
|
||||
|
||||
protected override void ConfigureAutoRunInternal(bool autorun)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using Emby.Server.Core.Data;
|
||||
using Microsoft.Data.Sqlite;
|
||||
|
||||
namespace Emby.Server.Data
|
||||
{
|
||||
public class DbConnector : IDbConnector
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public DbConnector(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<IDbConnection> Connect(string dbPath, bool isReadOnly, bool enablePooling = false, int? cacheSize = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(dbPath))
|
||||
{
|
||||
throw new ArgumentNullException("dbPath");
|
||||
}
|
||||
|
||||
//SQLiteConnection.SetMemoryStatus(false);
|
||||
|
||||
var connectionstr = new SqliteConnectionStringBuilder
|
||||
{
|
||||
//PageSize = 4096,
|
||||
//CacheSize = cacheSize ?? 2000,
|
||||
//SyncMode = SynchronizationModes.Normal,
|
||||
DataSource = dbPath,
|
||||
//JournalMode = SQLiteJournalModeEnum.Wal,
|
||||
|
||||
// This is causing crashing under linux
|
||||
//Pooling = enablePooling && Environment.OSVersion.Platform == PlatformID.Win32NT,
|
||||
//ReadOnly = isReadOnly,
|
||||
Cache = enablePooling ? SqliteCacheMode.Default : SqliteCacheMode.Private,
|
||||
Mode = isReadOnly ? SqliteOpenMode.ReadOnly : SqliteOpenMode.ReadWriteCreate
|
||||
};
|
||||
|
||||
var connectionString = connectionstr.ConnectionString;
|
||||
|
||||
var connection = new SqliteConnection(connectionString);
|
||||
|
||||
await connection.OpenAsync().ConfigureAwait(false);
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,11 @@ using Emby.Common.Implementations.Logging;
|
||||
using Emby.Common.Implementations.Networking;
|
||||
using Emby.Drawing;
|
||||
using Emby.Server.Core;
|
||||
using Emby.Server.Core.Browser;
|
||||
using Emby.Server.Implementations.Browser;
|
||||
using Emby.Server.Implementations.IO;
|
||||
using MediaBrowser.Common.Net;
|
||||
using Emby.Server.IO;
|
||||
using Emby.Server.Implementations;
|
||||
|
||||
namespace Emby.Server
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user