public void SqlServerCustomVarBinaryMaxOverflowParameterSizeAsDataParameter([IncludeDataSources(TestProvName.AllSqlServer2005Plus)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema, true); using (var table = db.CreateLocalTable <AllTypesCustomMaxLength>()) { var value = new byte[10000]; for (var i = 0; i < value.Length; i++) { value[i] = (byte)(i % 256); } table.Insert(() => new AllTypesCustomMaxLength() { VarBinary = new VarBinary() { Value = value } }); var records = table.ToList(); var p = new VarBinary() { Value = value }; var sql = table.Where(t => t.VarBinary == p).ToString() !; Assert.AreEqual(1, records.Count); Assert.IsNotNull(records[0].VarBinary); Assert.AreEqual(value, records[0].VarBinary !.Value); Assert.That(sql.Contains("VarBinary(10000) -- Binary")); } } }
public void SqlServerCustomVarBinaryKnownOverflowParameterSizeAsDataParameter([IncludeDataSources(TestProvName.AllSqlServer)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema, true); var p = new VarBinary() { Value = new byte[] { 1, 2 } }; var sql = db.GetTable <AllTypesCustomWithLength>().Where(t => t.VarBinaryDataType == p).ToString(); Console.WriteLine(sql); Assert.That(sql, Contains.Substring("(8000)")); } }
public void SqlServerCustomVarBinary8000ParameterSize([IncludeDataSources(TestProvName.AllSqlServer)] string context) { using (var db = new DataConnection(context, new MappingSchema())) { SetupCustomTypes(db.MappingSchema); var p = new VarBinary() { Value = new byte[] { 1 } }; var sql = db.GetTable <AllTypesCustom>().Where(t => t.VarBinaryDataType == p).ToString(); TestContext.WriteLine(sql); Assert.That(sql, Contains.Substring("VarBinary -- Binary")); } }