diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs index 2f3f34aa4..cc9e3ebcc 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteExtensions.cs @@ -19,11 +19,7 @@ namespace MediaBrowser.Server.Implementations.Persistence /// <summary> /// Connects to db. /// </summary> - /// <param name="dbPath">The db path.</param> - /// <param name="logger">The logger.</param> - /// <returns>Task{IDbConnection}.</returns> - /// <exception cref="System.ArgumentNullException">dbPath</exception> - public static async Task<IDbConnection> ConnectToDb(string dbPath, int? cacheSize, ILogger logger) + public static async Task<IDbConnection> ConnectToDb(string dbPath, bool isReadOnly, bool enablePooling, int? cacheSize, ILogger logger) { if (string.IsNullOrEmpty(dbPath)) { @@ -38,7 +34,9 @@ namespace MediaBrowser.Server.Implementations.Persistence CacheSize = cacheSize ?? 2000, SyncMode = SynchronizationModes.Normal, DataSource = dbPath, - JournalMode = SQLiteJournalModeEnum.Wal + JournalMode = SQLiteJournalModeEnum.Wal, + Pooling = enablePooling, + ReadOnly = isReadOnly }; var connection = new SQLiteConnection(connectionstr.ConnectionString); @@ -47,15 +45,5 @@ namespace MediaBrowser.Server.Implementations.Persistence return connection; } - - public static void BindFunction(this SQLiteConnection connection, SQLiteFunction function) - { - var attributes = function.GetType().GetCustomAttributes(typeof(SQLiteFunctionAttribute), true).Cast<SQLiteFunctionAttribute>().ToArray(); - if (attributes.Length == 0) - { - throw new InvalidOperationException("SQLiteFunction doesn't have SQLiteFunctionAttribute"); - } - connection.BindFunction(attributes[0], function); - } } } |
