update music tabs

pull/702/head
Luke Pulverenti 9 years ago
parent c21a971b98
commit 9ad551c77c

@ -1643,9 +1643,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)) using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
{ {
//Logger.Debug("GetItemList query time: {0}ms. Query: {1}", LogQueryTime("GetItemList", cmd, now);
// Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
// cmd.CommandText);
while (reader.Read()) while (reader.Read())
{ {
@ -1659,6 +1657,26 @@ namespace MediaBrowser.Server.Implementations.Persistence
} }
} }
private void LogQueryTime(string methodName, IDbCommand cmd, DateTime startDate)
{
var elapsed = (DateTime.UtcNow - startDate).TotalMilliseconds;
if (elapsed >= 500)
{
Logger.Debug("{2} query time (slow): {0}ms. Query: {1}",
Convert.ToInt32(elapsed),
cmd.CommandText,
methodName);
}
else
{
//Logger.Debug("{2} query time: {0}ms. Query: {1}",
// Convert.ToInt32(elapsed),
// cmd.CommandText,
// methodName);
}
}
public QueryResult<BaseItem> GetItems(InternalItemsQuery query) public QueryResult<BaseItem> GetItems(InternalItemsQuery query)
{ {
if (query == null) if (query == null)
@ -1728,9 +1746,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{ {
//Logger.Debug("GetItems query time: {0}ms. Query: {1}", LogQueryTime("GetItems", cmd, now);
// Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
// cmd.CommandText);
while (reader.Read()) while (reader.Read())
{ {
@ -1878,9 +1894,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult)) using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
{ {
//Logger.Debug("GetItemIdsList query time: {0}ms. Query: {1}", LogQueryTime("GetItemIdsList", cmd, now);
// Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
// cmd.CommandText);
while (reader.Read()) while (reader.Read())
{ {
@ -2036,9 +2050,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess)) using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess))
{ {
//Logger.Debug("GetItemIds query time: {0}ms. Query: {1}", LogQueryTime("GetItemIds", cmd, now);
// Convert.ToInt32((DateTime.UtcNow - now).TotalMilliseconds),
// cmd.CommandText);
while (reader.Read()) while (reader.Read())
{ {
@ -2562,8 +2574,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
clause += " OR "; clause += " OR ";
} }
clause += "Album=@AlbumName" + index; clause += "Album=@AlbumName" + index;
index++;
cmd.Parameters.Add(cmd, "@AlbumName" + index, DbType.String).Value = name; cmd.Parameters.Add(cmd, "@AlbumName" + index, DbType.String).Value = name;
index++;
} }
clause += ")"; clause += ")";

Loading…
Cancel
Save