Merge pull request #1650 from Bond-009/sqlitepclv2

Upgrade SQLitePCL to v2
This commit is contained in:
Joshua M. Boniface 2019-08-19 14:43:54 -04:00 committed by GitHub
commit d99278da1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 24 deletions

View file

@ -215,13 +215,7 @@ namespace Emby.Server.Implementations.Data
} }
private DisplayPreferences Get(IReadOnlyList<IResultSetValue> row) private DisplayPreferences Get(IReadOnlyList<IResultSetValue> row)
{ => _jsonSerializer.DeserializeFromString<DisplayPreferences>(row.GetString(0));
using (var stream = new MemoryStream(row[0].ToBlob()))
{
stream.Position = 0;
return _jsonSerializer.DeserializeFromStream<DisplayPreferences>(stream);
}
}
public void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken) public void SaveDisplayPreferences(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken)
{ {

View file

@ -18,10 +18,6 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(conn => connection.RunInTransaction(conn =>
{ {
//foreach (var query in queries)
//{
// conn.Execute(query);
//}
conn.ExecuteAll(string.Join(";", queries)); conn.ExecuteAll(string.Join(";", queries));
}); });
} }
@ -38,7 +34,8 @@ namespace Emby.Server.Implementations.Data
public static Guid ReadGuidFromBlob(this IResultSetValue result) public static Guid ReadGuidFromBlob(this IResultSetValue result)
{ {
return new Guid(result.ToBlob()); // TODO: Remove ToArray when upgrading to netstandard2.1
return new Guid(result.ToBlob().ToArray());
} }
public static string ToDateTimeParamValue(this DateTime dateValue) public static string ToDateTimeParamValue(this DateTime dateValue)

View file

@ -35,9 +35,8 @@ namespace Emby.Server.Implementations.Data
public string Name => "SQLite"; public string Name => "SQLite";
/// <summary> /// <summary>
/// Opens the connection to the database /// Opens the connection to the database.
/// </summary> /// </summary>
/// <returns>Task.</returns>
public void Initialize() public void Initialize()
{ {
using (var connection = GetConnection()) using (var connection = GetConnection())
@ -180,14 +179,10 @@ namespace Emby.Server.Implementations.Data
var id = row[0].ToInt64(); var id = row[0].ToInt64();
var guid = row[1].ReadGuidFromBlob(); var guid = row[1].ReadGuidFromBlob();
using (var stream = new MemoryStream(row[2].ToBlob())) var user = _jsonSerializer.DeserializeFromString<User>(row.GetString(2));
{ user.InternalId = id;
stream.Position = 0; user.Id = guid;
var user = _jsonSerializer.DeserializeFromStream<User>(stream); return user;
user.InternalId = id;
user.Id = guid;
return user;
}
} }
/// <summary> /// <summary>

View file

@ -34,7 +34,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.2.0" />
<PackageReference Include="ServiceStack.Text.Core" Version="5.6.0" /> <PackageReference Include="ServiceStack.Text.Core" Version="5.6.0" />
<PackageReference Include="sharpcompress" Version="0.23.0" /> <PackageReference Include="sharpcompress" Version="0.23.0" />
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="1.0.0" /> <PackageReference Include="SQLitePCL.pretty.netstandard" Version="2.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -43,7 +43,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" /> <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="SkiaSharp" Version="1.68.0" /> <PackageReference Include="SkiaSharp" Version="1.68.0" />
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="1.1.14" /> <PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="2.0.0" />
<PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.14" /> <PackageReference Include="SQLitePCLRaw.provider.sqlite3.netstandard11" Version="1.1.14" />
</ItemGroup> </ItemGroup>