<commit_before>﻿using Microsoft.SqlServer.Server;
using System.Data;
using System.Data.SqlClient;

namespace unQuery.SqlTypes
{
	public class SqlImage : SqlType, ISqlType, ITypeHandler
	{
		private static readonly ITypeHandler typeHandler = new SqlImage();

		private readonly byte[] value;
		private readonly bool hasValue;

		private SqlImage()
		{ }

		internal static ITypeHandler GetTypeHandler()
		{
			return typeHandler;
		}

		SqlParameter ITypeHandler.CreateParamFromValue(object value)
		{
			throw new TypeCannotBeUsedAsAClrTypeException();
		}

		SqlMetaData ITypeHandler.CreateMetaData(string name)
		{
			if (!hasValue)
				throw new TypeCannotBeUsedAsAClrTypeException();

			return new SqlMetaData(name, SqlDbType.Image, -1);
		}

		public SqlImage(byte[] value)
		{
			this.value = value;

			hasValue = true;
		}

		SqlParameter ISqlType.GetParameter()
		{
			return new SqlParameter {
				SqlDbType = SqlDbType.Image,
				Value = GetDBNullableValue(value),
				Size = -1
			};
		}

		object ISqlType.GetRawValue()
		{
			return value;
		}
	}
}<commit_msg>SqlImage now derives from ExplicitMaxLengthType<commit_after>﻿using System.Data;

namespace unQuery.SqlTypes
{
	public class SqlImage : ExplicitMaxLengthType<byte[]>
	{
		private SqlImage() :
			base(SqlDbType.Image)
		{ }

		public SqlImage(byte[] value) :
			base(value, -1, SqlDbType.Image)
		{ }

		private static readonly ITypeHandler typeHandler = new SqlImage();
		internal static ITypeHandler GetTypeHandler()
		{
			return typeHandler;
		}
	}
}
{'fraction_non_alphanumeric': 0.09358638743455497, 'fraction_numerical': 0.001963350785340314, 'mean_word_length': 3.996732026143791, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6417010', 'n_tokens_mistral': 564, 'n_tokens_neox': 483, 'n_words': 112}