diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations')
3 files changed, 26 insertions, 13 deletions
diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index e58369df1..294a7f41c 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -82,11 +82,13 @@ </Reference> <Reference Include="System" /> <Reference Include="System.Core" /> - <Reference Include="System.Data.SQLite"> - <HintPath>..\packages\System.Data.SQLite.x86.1.0.86.0\lib\net45\System.Data.SQLite.dll</HintPath> + <Reference Include="System.Data.SQLite, Version=1.0.87.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\System.Data.SQLite.x86.1.0.87.0\lib\net45\System.Data.SQLite.dll</HintPath> </Reference> - <Reference Include="System.Data.SQLite.Linq"> - <HintPath>..\packages\System.Data.SQLite.x86.1.0.86.0\lib\net45\System.Data.SQLite.Linq.dll</HintPath> + <Reference Include="System.Data.SQLite.Linq, Version=1.0.87.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\packages\System.Data.SQLite.x86.1.0.87.0\lib\net45\System.Data.SQLite.Linq.dll</HintPath> </Reference> <Reference Include="System.Reactive.Core"> <HintPath>..\packages\Rx-Core.2.1.30214.0\lib\Net45\System.Reactive.Core.dll</HintPath> diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs index 7a984fc00..8cd618d21 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteDisplayPreferencesRepository.cs @@ -85,9 +85,8 @@ namespace MediaBrowser.Server.Implementations.Persistence string[] queries = { - "create table if not exists displaypreferences (id GUID, data BLOB)", - "create unique index if not exists displaypreferencesindex on displaypreferences (id)", - "create table if not exists schema_version (table_name primary key, version)", + "create table if not exists userdisplaypreferences (id GUID, userId GUID, client text, data BLOB)", + "create unique index if not exists userdisplaypreferencesindex on userdisplaypreferences (id, userId, client)", //pragmas "pragma temp_store = memory" }; @@ -99,10 +98,12 @@ namespace MediaBrowser.Server.Implementations.Persistence /// Save the display preferences associated with an item in the repo /// </summary> /// <param name="displayPreferences">The display preferences.</param> + /// <param name="userId">The user id.</param> + /// <param name="client">The client.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task.</returns> /// <exception cref="System.ArgumentNullException">item</exception> - public async Task SaveDisplayPreferences(DisplayPreferences displayPreferences, CancellationToken cancellationToken) + public async Task SaveDisplayPreferences(DisplayPreferences displayPreferences, Guid userId, string client, CancellationToken cancellationToken) { if (displayPreferences == null) { @@ -131,9 +132,11 @@ namespace MediaBrowser.Server.Implementations.Persistence using (var cmd = _connection.CreateCommand()) { - cmd.CommandText = "replace into displaypreferences (id, data) values (@1, @2)"; + cmd.CommandText = "replace into userdisplaypreferences (id, userid, client, data) values (@1, @2, @3, @4)"; cmd.AddParam("@1", displayPreferences.Id); - cmd.AddParam("@2", serialized); + cmd.AddParam("@2", userId); + cmd.AddParam("@3", client); + cmd.AddParam("@4", serialized); cmd.Transaction = transaction; @@ -177,9 +180,11 @@ namespace MediaBrowser.Server.Implementations.Persistence /// Gets the display preferences. /// </summary> /// <param name="displayPreferencesId">The display preferences id.</param> + /// <param name="userId">The user id.</param> + /// <param name="client">The client.</param> /// <returns>Task{DisplayPreferences}.</returns> /// <exception cref="System.ArgumentNullException">item</exception> - public DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId) + public DisplayPreferences GetDisplayPreferences(Guid displayPreferencesId, Guid userId, string client) { if (displayPreferencesId == Guid.Empty) { @@ -187,11 +192,17 @@ namespace MediaBrowser.Server.Implementations.Persistence } var cmd = _connection.CreateCommand(); - cmd.CommandText = "select data from displaypreferences where id = @id"; + cmd.CommandText = "select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"; var idParam = cmd.Parameters.Add("@id", DbType.Guid); idParam.Value = displayPreferencesId; + var userIdParam = cmd.Parameters.Add("@userId", DbType.Guid); + userIdParam.Value = userId; + + var clientParam = cmd.Parameters.Add("@client", DbType.String); + clientParam.Value = client; + using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult | CommandBehavior.SingleRow)) { if (reader.Read()) diff --git a/MediaBrowser.Server.Implementations/packages.config b/MediaBrowser.Server.Implementations/packages.config index 974c4c9bc..b9868a4d3 100644 --- a/MediaBrowser.Server.Implementations/packages.config +++ b/MediaBrowser.Server.Implementations/packages.config @@ -14,5 +14,5 @@ <package id="ServiceStack.Redis" version="3.9.43" targetFramework="net45" /> <package id="ServiceStack.Text" version="3.9.55" targetFramework="net45" /> <package id="SharpZipLib" version="0.86.0" targetFramework="net45" /> - <package id="System.Data.SQLite.x86" version="1.0.86.0" targetFramework="net45" /> + <package id="System.Data.SQLite.x86" version="1.0.87.0" targetFramework="net45" /> </packages>
\ No newline at end of file |
