diff options
Diffstat (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/BaseSqliteRepository.cs | 30 |
1 files changed, 28 insertions, 2 deletions
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() { |
