update transaction modes

This commit is contained in:
Luke Pulverenti 2016-11-28 14:26:48 -05:00
parent 56b24da151
commit 1c52e4f51b
11 changed files with 40 additions and 33 deletions

View File

@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Activity
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}

View File

@ -30,6 +30,11 @@ namespace Emby.Server.Implementations.Data
get { return false; }
}
protected TransactionMode TransactionMode
{
get { return TransactionMode.Immediate; }
}
static BaseSqliteRepository()
{
SQLite3.EnableSharedCache = false;

View File

@ -100,7 +100,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(db =>
{
SaveDisplayPreferences(displayPreferences, userId, client, db);
});
}, TransactionMode);
}
}
}
@ -147,7 +147,7 @@ namespace Emby.Server.Implementations.Data
{
SaveDisplayPreferences(displayPreference, userId, displayPreference.Client, db);
}
});
}, TransactionMode);
}
}
}

View File

@ -85,7 +85,7 @@ namespace Emby.Server.Implementations.Data
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@ResultId", id.ToGuidParamValue());
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -124,7 +124,7 @@ namespace Emby.Server.Implementations.Data
var commandText = "delete from FileOrganizerResults";
db.Execute(commandText);
});
}, TransactionMode);
}
}
}

View File

@ -316,7 +316,7 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames);
AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
});
}, TransactionMode);
string[] postQueries =
@ -697,7 +697,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(db =>
{
SaveItemsInTranscation(db, tuples);
});
}, TransactionMode);
}
}
}
@ -2211,7 +2211,7 @@ namespace Emby.Server.Implementations.Data
index++;
}
}
});
}, TransactionMode);
}
}
}
@ -4531,7 +4531,7 @@ namespace Emby.Server.Implementations.Data
// Delete the item
ExecuteWithSingleParam(db, "delete from TypedBaseItems where guid=@Id", id.ToGuidParamValue());
});
}, TransactionMode);
}
}
}

View File

@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.Data
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
});
}, TransactionMode);
ImportUserDataIfNeeded(connection);
}
@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@IsUserDataImported", true);
statement.MoveNext();
}
});
}, TransactionMode);
}
private void ImportUserData(IDatabaseConnection connection, string file)
@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(db =>
{
db.Execute("REPLACE INTO userdata(" + columns + ") SELECT " + columns + " FROM UserDataBackup.userdata;");
});
}, TransactionMode);
}
/// <summary>
@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.Data
connection.RunInTransaction(db =>
{
SaveUserData(db, userId, key, userData);
});
}, TransactionMode);
}
}
}
@ -271,7 +271,7 @@ namespace Emby.Server.Implementations.Data
{
SaveUserData(db, userId, userItemData.Key, userItemData);
}
});
}, TransactionMode);
}
}
}

View File

@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@data", serialized);
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.Data
statement.TryBind("@id", user.Id.ToGuidParamValue());
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}

View File

@ -249,7 +249,7 @@ namespace Emby.Server.Implementations.Notifications
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -304,7 +304,7 @@ namespace Emby.Server.Implementations.Notifications
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -334,7 +334,7 @@ namespace Emby.Server.Implementations.Notifications
}
}
});
}, TransactionMode);
}
}
}

View File

@ -50,7 +50,8 @@ namespace Emby.Server.Implementations.Security
var existingColumnNames = GetColumnNames(db, "AccessTokens");
AddColumn(db, "AccessTokens", "AppVersion", "TEXT", existingColumnNames);
});
}, TransactionMode);
}
}
@ -70,9 +71,9 @@ namespace Emby.Server.Implementations.Security
cancellationToken.ThrowIfCancellationRequested();
using (WriteLock.Write())
using (var connection = CreateConnection())
{
using (var connection = CreateConnection())
using (WriteLock.Write())
{
connection.RunInTransaction(db =>
{
@ -100,7 +101,8 @@ namespace Emby.Server.Implementations.Security
statement.MoveNext();
}
});
}, TransactionMode);
}
}
}
@ -137,9 +139,9 @@ namespace Emby.Server.Implementations.Security
throw new ArgumentNullException("query");
}
using (WriteLock.Read())
using (var connection = CreateConnection(true))
{
using (var connection = CreateConnection(true))
using (WriteLock.Read())
{
var commandText = BaseSelectText;
@ -244,9 +246,9 @@ namespace Emby.Server.Implementations.Security
throw new ArgumentNullException("id");
}
using (WriteLock.Read())
using (var connection = CreateConnection(true))
{
using (var connection = CreateConnection(true))
using (WriteLock.Read())
{
var commandText = BaseSelectText + " where Id=@Id";

View File

@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Social
info.ItemId,
info.UserId,
info.ExpirationDate.ToDateTimeParamValue());
});
}, TransactionMode);
}
}
}

View File

@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Sync
existingColumnNames = GetColumnNames(db, "SyncJobItems");
AddColumn(db, "SyncJobItems", "ItemDateModifiedTicks", "BIGINT", existingColumnNames);
});
}, TransactionMode);
}
}
@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Sync
connection.RunInTransaction(conn =>
{
conn.Execute(commandText, paramList.ToArray());
});
}, TransactionMode);
}
}
}
@ -290,7 +290,7 @@ namespace Emby.Server.Implementations.Sync
{
conn.Execute("delete from SyncJobs where Id=?", id.ToGuidParamValue());
conn.Execute("delete from SyncJobItems where JobId=?", id);
});
}, TransactionMode);
}
}
}
@ -743,7 +743,7 @@ namespace Emby.Server.Implementations.Sync
connection.RunInTransaction(conn =>
{
conn.Execute(commandText, paramList.ToArray());
});
}, TransactionMode);
}
}
}