From ffb1ec76a785cdd2aef8ccbe8125a1f765559b15 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 19 Nov 2016 02:51:07 -0500 Subject: update components --- .../Data/BaseSqliteRepository.cs | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'Emby.Server.Implementations/Data') diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index c47a534d1..5a4846ccf 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using MediaBrowser.Model.Logging; using SQLitePCL.pretty; using System.Linq; +using SQLitePCL; namespace Emby.Server.Implementations.Data { @@ -24,12 +25,20 @@ namespace Emby.Server.Implementations.Data get { return true; } } - protected virtual SQLiteDatabaseConnection CreateConnection(bool isReadOnly = false) + static BaseSqliteRepository() { SQLite3.EnableSharedCache = false; + int rc = raw.sqlite3_config(raw.SQLITE_CONFIG_MEMSTATUS, 0); + //CheckOk(rc); + } + + protected virtual SQLiteDatabaseConnection CreateConnection(bool isReadOnly = false) + { ConnectionFlags connectionFlags; + //isReadOnly = false; + if (isReadOnly) { connectionFlags = ConnectionFlags.ReadOnly; @@ -70,10 +79,27 @@ namespace Emby.Server.Implementations.Data //} db.ExecuteAll(string.Join(";", queries)); - + return db; } + internal static void CheckOk(int rc) + { + string msg = ""; + + if (raw.SQLITE_OK != rc) + { + throw CreateException((ErrorCode)rc, msg); + } + } + + internal static Exception CreateException(ErrorCode rc, string msg) + { + var exp = new Exception(msg); + + return exp; + } + private bool _disposed; protected void CheckDisposed() { -- cgit v1.2.3