diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-24 20:54:51 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-09-24 20:54:51 -0400 |
| commit | fe5a9232c84cea113336005b3c7cbd7fe77a2d80 (patch) | |
| tree | 9fb1412f4a8ca4303ec276b6ab6e096f98eed58d /MediaBrowser.Server.Mono/Native/Sqlite.cs | |
| parent | 0ab379e271afe69372806ab0e24a874d3f085456 (diff) | |
moved a few things for mono
Diffstat (limited to 'MediaBrowser.Server.Mono/Native/Sqlite.cs')
| -rw-r--r-- | MediaBrowser.Server.Mono/Native/Sqlite.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Mono/Native/Sqlite.cs b/MediaBrowser.Server.Mono/Native/Sqlite.cs new file mode 100644 index 000000000..cc20952d7 --- /dev/null +++ b/MediaBrowser.Server.Mono/Native/Sqlite.cs @@ -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; + } + } +} |
