mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	update extension
This commit is contained in:
		
							parent
							
								
									64d15be839
								
							
						
					
					
						commit
						a385ab5142
					
				@ -173,6 +173,15 @@ namespace Emby.Server.Implementations.Data
 | 
				
			|||||||
            return result[index].ReadGuid();
 | 
					            return result[index].ReadGuid();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, double value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            IBindParameter bindParam;
 | 
				
			||||||
 | 
					            if (bindParameters.TryGetValue(name, out bindParam))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                bindParam.Bind(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, string value)
 | 
					        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, string value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            IBindParameter bindParam;
 | 
					            IBindParameter bindParam;
 | 
				
			||||||
@ -191,6 +200,24 @@ namespace Emby.Server.Implementations.Data
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, int value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            IBindParameter bindParam;
 | 
				
			||||||
 | 
					            if (bindParameters.TryGetValue(name, out bindParam))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                bindParam.Bind(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, long value)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            IBindParameter bindParam;
 | 
				
			||||||
 | 
					            if (bindParameters.TryGetValue(name, out bindParam))
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                bindParam.Bind(value);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, byte[] value)
 | 
					        public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, byte[] value)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            IBindParameter bindParam;
 | 
					            IBindParameter bindParam;
 | 
				
			||||||
 | 
				
			|||||||
@ -150,29 +150,54 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//        private void SaveUserData(IDatabaseConnection db, Guid userId, string key, UserItemData userData)
 | 
					//        private void SaveUserData(IDatabaseConnection db, Guid userId, string key, UserItemData userData)
 | 
				
			||||||
//        {
 | 
					//        {
 | 
				
			||||||
//            var paramList = new List<object>();
 | 
					//            using (var statement = _connection.PrepareStatement("replace into userdata (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
 | 
				
			||||||
//            var commandText = "replace into userdata (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (?, ?, ?,?,?,?,?,?,?,?)";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//            paramList.Add(key);
 | 
					 | 
				
			||||||
//            paramList.Add(userId.ToGuidParamValue());
 | 
					 | 
				
			||||||
//            paramList.Add(userData.Rating);
 | 
					 | 
				
			||||||
//            paramList.Add(userData.Played);
 | 
					 | 
				
			||||||
//            paramList.Add(userData.PlayCount);
 | 
					 | 
				
			||||||
//            paramList.Add(userData.IsFavorite);
 | 
					 | 
				
			||||||
//            paramList.Add(userData.PlaybackPositionTicks);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//            if (userData.LastPlayedDate.HasValue)
 | 
					 | 
				
			||||||
//            {
 | 
					//            {
 | 
				
			||||||
//                paramList.Add(userData.LastPlayedDate.Value.ToDateTimeParamValue());
 | 
					//                statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@Key", key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//                if (userData.Rating.HasValue)
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBind("@rating", userData.Rating.Value);
 | 
				
			||||||
//                }
 | 
					//                }
 | 
				
			||||||
//                else
 | 
					//                else
 | 
				
			||||||
//                {
 | 
					//                {
 | 
				
			||||||
//                paramList.Add(null);
 | 
					//                    statement.BindParameters.TryBindNull("@rating");
 | 
				
			||||||
//                }
 | 
					//                }
 | 
				
			||||||
//            paramList.Add(userData.AudioStreamIndex);
 | 
					 | 
				
			||||||
//            paramList.Add(userData.SubtitleStreamIndex);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            db.Execute(commandText, paramList.ToArray());
 | 
					//                statement.BindParameters.TryBind("@played", userData.Played);
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@playCount", userData.PlayCount);
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@isFavorite", userData.IsFavorite);
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@playbackPositionTicks", userData.PlaybackPositionTicks);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//                if (userData.LastPlayedDate.HasValue)
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBind("@lastPlayedDate", userData.LastPlayedDate.Value.ToDateTimeParamValue());
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					//                else
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBindNull("@lastPlayedDate");
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//                if (userData.AudioStreamIndex.HasValue)
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBind("@AudioStreamIndex", userData.AudioStreamIndex.Value);
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					//                else
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBindNull("@AudioStreamIndex");
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//                if (userData.SubtitleStreamIndex.HasValue)
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBind("@SubtitleStreamIndex", userData.SubtitleStreamIndex.Value);
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					//                else
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBindNull("@SubtitleStreamIndex");
 | 
				
			||||||
 | 
					//                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//                statement.MoveNext();
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//        /// <summary>
 | 
					//        /// <summary>
 | 
				
			||||||
@ -216,16 +241,16 @@
 | 
				
			|||||||
//                throw new ArgumentNullException("key");
 | 
					//                throw new ArgumentNullException("key");
 | 
				
			||||||
//            }
 | 
					//            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            var commandText = "select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key = ? and userId=?";
 | 
					//            using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key =@Key and userId=@UserId"))
 | 
				
			||||||
 | 
					//            {
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
 | 
				
			||||||
 | 
					//                statement.BindParameters.TryBind("@Key", key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            var paramList = new List<object>();
 | 
					//                foreach (var row in statement.ExecuteQuery())
 | 
				
			||||||
//            paramList.Add(key);
 | 
					 | 
				
			||||||
//            paramList.Add(userId.ToGuidParamValue());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//            foreach (var row in _connection.Query(commandText, paramList.ToArray()))
 | 
					 | 
				
			||||||
//                {
 | 
					//                {
 | 
				
			||||||
//                    return ReadRow(row);
 | 
					//                    return ReadRow(row);
 | 
				
			||||||
//                }
 | 
					//                }
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            return null;
 | 
					//            return null;
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
@ -265,16 +290,16 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//            using (WriteLock.Read())
 | 
					//            using (WriteLock.Read())
 | 
				
			||||||
//            {
 | 
					//            {
 | 
				
			||||||
//                var commandText = "select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where userId=?";
 | 
					//                using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where userId=@UserId"))
 | 
				
			||||||
 | 
					//                {
 | 
				
			||||||
 | 
					//                    statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//                var paramList = new List<object>();
 | 
					//                    foreach (var row in statement.ExecuteQuery())
 | 
				
			||||||
//                paramList.Add(userId.ToGuidParamValue());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//                foreach (var row in _connection.Query(commandText, paramList.ToArray()))
 | 
					 | 
				
			||||||
//                    {
 | 
					//                    {
 | 
				
			||||||
//                        list.Add(ReadRow(row));
 | 
					//                        list.Add(ReadRow(row));
 | 
				
			||||||
//                    }
 | 
					//                    }
 | 
				
			||||||
//                }
 | 
					//                }
 | 
				
			||||||
 | 
					//            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//            return list;
 | 
					//            return list;
 | 
				
			||||||
//        }
 | 
					//        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user