aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-14 09:24:30 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-08-14 09:24:30 -0400
commit9c5cceb4ecc277ffb5a3a988f655ad674bf41c58 (patch)
tree0077c03cb06e2dc7700315f90db9ee51fedeb00d /MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs
parent02e25b48550ffef016d20fe3f070c8552633cbef (diff)
update translations
Diffstat (limited to 'MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs28
1 files changed, 19 insertions, 9 deletions
diff --git a/MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs b/MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs
index 43a960ea2..cd20ad74d 100644
--- a/MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs
+++ b/MediaBrowser.Server.Implementations/Security/AuthenticationRepository.cs
@@ -157,12 +157,6 @@ namespace MediaBrowser.Server.Implementations.Security
var startIndex = query.StartIndex ?? 0;
- if (startIndex > 0)
- {
- whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM AccessTokens ORDER BY DateCreated LIMIT {0})",
- startIndex.ToString(_usCulture)));
- }
-
if (!string.IsNullOrWhiteSpace(query.AccessToken))
{
whereClauses.Add("AccessToken=@AccessToken");
@@ -187,11 +181,27 @@ namespace MediaBrowser.Server.Implementations.Security
cmd.Parameters.Add(cmd, "@IsActive", DbType.Boolean).Value = query.IsActive.Value;
}
- if (whereClauses.Count > 0)
+ var whereTextWithoutPaging = whereClauses.Count == 0 ?
+ string.Empty :
+ " where " + string.Join(" AND ", whereClauses.ToArray());
+
+ if (startIndex > 0)
{
- cmd.CommandText += " where " + string.Join(" AND ", whereClauses.ToArray());
+ var pagingWhereText = whereClauses.Count == 0 ?
+ string.Empty :
+ " where " + string.Join(" AND ", whereClauses.ToArray());
+
+ whereClauses.Add(string.Format("Id NOT IN (SELECT Id FROM AccessTokens {0} ORDER BY DateCreated LIMIT {1})",
+ pagingWhereText,
+ startIndex.ToString(_usCulture)));
}
+ var whereText = whereClauses.Count == 0 ?
+ string.Empty :
+ " where " + string.Join(" AND ", whereClauses.ToArray());
+
+ cmd.CommandText += whereText;
+
cmd.CommandText += " ORDER BY DateCreated";
if (query.Limit.HasValue)
@@ -199,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.Security
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(_usCulture);
}
- cmd.CommandText += "; select count (Id) from AccessTokens";
+ cmd.CommandText += "; select count (Id) from AccessTokens" + whereTextWithoutPaging;
var list = new List<AuthenticationInfo>();
var count = 0;