mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-09 11:52:07 +01:00
moved a few things for mono
This commit is contained in:
36
MediaBrowser.ServerApplication/Native/Sqlite.cs
Normal file
36
MediaBrowser.ServerApplication/Native/Sqlite.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// Class Sqlite
|
||||
/// </summary>
|
||||
public static class Sqlite
|
||||
{
|
||||
/// <summary>
|
||||
/// Connects to db.
|
||||
/// </summary>
|
||||
/// <param name="dbPath">The db path.</param>
|
||||
/// <returns>Task{IDbConnection}.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">dbPath</exception>
|
||||
public static async Task<IDbConnection> OpenDatabase(string dbPath)
|
||||
{
|
||||
var connectionstr = new SQLiteConnectionStringBuilder
|
||||
{
|
||||
PageSize = 4096,
|
||||
CacheSize = 4096,
|
||||
SyncMode = SynchronizationModes.Normal,
|
||||
DataSource = dbPath,
|
||||
JournalMode = SQLiteJournalModeEnum.Wal
|
||||
};
|
||||
|
||||
var connection = new SQLiteConnection(connectionstr.ConnectionString);
|
||||
|
||||
await connection.OpenAsync().ConfigureAwait(false);
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user