@@ -80,7 +80,20 @@ @output int output
8080 set @output = 10
8181end" ;
8282 private readonly string _dropJustTextProc = @"drop procedure [dbo].[sp_just_test_echo_text]" ;
83-
83+
84+
85+ private readonly string _createInsertTextProc = @"
86+ create procedure [dbo].[sp_insert_test_echo_text]
87+ @input text,
88+ @output int output
89+ as
90+ begin
91+ insert into [dbo].[test_text_table] (Fragment) VALUES (@input)
92+ set @output = 10
93+ end" ;
94+
95+ private readonly string _dropInsertTextProc = @"drop procedure [dbo].[sp_insert_test_echo_text]" ;
96+
8497 public TextEchoProcedureTests ( )
8598 {
8699 Logger . Enable ( ) ;
@@ -97,6 +110,7 @@ public void Setup()
97110 connection . Execute ( _createTrueEchoTextLocatorProc ) ;
98111 connection . Execute ( _createTextTypeColumnProc ) ;
99112 connection . Execute ( _createJustTextProc ) ;
113+ connection . Execute ( _createInsertTextProc ) ;
100114 }
101115 }
102116
@@ -105,6 +119,7 @@ public void Teardown()
105119 {
106120 using ( var connection = new AseConnection ( ConnectionStrings . Pooled ) )
107121 {
122+ connection . Execute ( _dropInsertTextProc ) ;
108123 connection . Execute ( _dropEchoTextProc ) ;
109124 connection . Execute ( _dropTextTable ) ;
110125 connection . Execute ( _dropEchoTextLocatorProc ) ;
@@ -115,7 +130,7 @@ public void Teardown()
115130 }
116131
117132
118- [ Test ]
133+ [ Test , Ignore ( "Output text type" ) ]
119134 public void EchoText_Procedure_ShouldExecute ( )
120135 {
121136 using ( var connection = new AseConnection ( ConnectionStrings . Pooled ) )
@@ -276,7 +291,7 @@ public void TextTypeColumn_Proc_ShouldExecute_Ok(int length)
276291 command . CommandType = CommandType . StoredProcedure ;
277292
278293 //var expected = Enumerable.Repeat(new byte[] {0xde, 0xad, 0xbe, 0xef}, 64).SelectMany(x => x).Take(536386).ToArray();
279- var text_locator = new string ( 'x' , 16383 ) ;
294+ // var text_locator = new string('x', 16383);
280295 var just_text = new string ( 'y' , length ) ;
281296
282297 var p = command . CreateParameter ( ) ;
@@ -338,20 +353,22 @@ public void TextColumn_With_Data_Length_MoreThan_16384_ReturnSuccess(int length)
338353 //[TestCaseSource(nameof(Insert_Text_Length_GreaterThan_10000000))]
339354 //sp_configure 'procedure cache size', 24000
340355 [ TestCase ( 2000 ) ]
356+ [ TestCase ( 4000 ) ]
341357 [ TestCase ( 24000 ) ]
342358 [ TestCase ( 26000 ) ]
343359 [ TestCase ( 28000 ) ]
344- [ TestCase ( 20001000 ) ]
345- [ TestCase ( 20001500 ) ]
346- [ TestCase ( 20002000 ) ]
347- [ TestCase ( 20002500 ) ]
348- [ TestCase ( 20003000 ) ]
349- [ TestCase ( 20003500 ) ]
350- [ TestCase ( 20004000 ) ]
351- [ TestCase ( 20004500 ) ]
352- [ TestCase ( 20005000 ) ]
353- [ TestCase ( 20005500 ) ]
354- [ TestCase ( 20006000 ) ]
360+ [ TestCase ( 30000 ) ]
361+ //[TestCase(20001000)]
362+ //[TestCase(20001500)]
363+ //[TestCase(20002000)]
364+ //[TestCase(20002500)]
365+ //[TestCase(20003000)]
366+ //[TestCase(20003500)]
367+ //[TestCase(20004000)]
368+ //[TestCase(20004500)]
369+ //[TestCase(20005000)]
370+ //[TestCase(20005500)]
371+ //[TestCase(20006000)]
355372 public void TextColumn_Length_gt_10000000_ReturnError ( int length )
356373 {
357374 using ( var connection = new AseConnection ( ConnectionStrings . Pooled ) )
@@ -380,6 +397,43 @@ public void TextColumn_Length_gt_10000000_ReturnError(int length)
380397 }
381398 }
382399
400+
401+ [ TestCaseSource ( nameof ( Insert_Text_Length ) ) ]
402+ public void TextType_Column_Should_Insert_Via_StoredProc_Ok ( int length )
403+ {
404+ //AdoNetCore.AseClient.AseException : The token datastream length was not correct. This is an internal protocol error.
405+ using ( var connection = new AseConnection ( ConnectionStrings . Pooled ) )
406+ {
407+ connection . Open ( ) ;
408+ using ( var command = connection . CreateCommand ( ) )
409+ {
410+ command . CommandText = "sp_insert_test_echo_text" ;
411+ command . CommandType = CommandType . StoredProcedure ;
412+
413+ //var expected = Enumerable.Repeat(new byte[] {0xde, 0xad, 0xbe, 0xef}, 64).SelectMany(x => x).Take(536386).ToArray();
414+ //var text_locator = new string('x', 16383);
415+ var just_text = new string ( 'y' , length ) ;
416+
417+ var p = command . CreateParameter ( ) ;
418+
419+ p = command . CreateParameter ( ) ;
420+ p . ParameterName = "@input" ;
421+ p . Value = just_text ;
422+ p . DbType = DbType . String ;
423+ command . Parameters . Add ( p ) ;
424+
425+ var pOut = command . CreateParameter ( ) ;
426+ pOut . ParameterName = "@output" ;
427+ pOut . Value = DBNull . Value ;
428+ pOut . DbType = DbType . Int32 ;
429+ pOut . Direction = ParameterDirection . Output ;
430+ command . Parameters . Add ( pOut ) ;
431+
432+ command . ExecuteNonQuery ( ) ;
433+ }
434+ }
435+ }
436+
383437 [ Test ]
384438 public void Insert_Text_ShouldBeValid ( )
385439 {
@@ -393,10 +447,10 @@ public void Insert_Text_ShouldBeValid()
393447 fragmentCommand . CommandType = CommandType . Text ;
394448 fragmentCommand . Transaction = transaction ;
395449
396- var bytesSegmentSize = 16382 ;
397- // var bytesSegmentSize = 2048;
398- // var data = Enumerable.Repeat((byte) 0x65, 16384).ToArray();
399- var data = Enumerable . Repeat ( ( byte ) 0x65 , 6380 ) . ToArray ( ) ;
450+ // var bytesSegmentSize = 16382;
451+ var bytesSegmentSize = 2048 ;
452+ var data = Enumerable . Repeat ( ( byte ) 0x65 , 16384 ) . ToArray ( ) ;
453+ // var data = Enumerable.Repeat((byte) 0x65, 6380).ToArray();
400454 var totalSegment = GetTotalSegments ( data . Length , bytesSegmentSize ) ;
401455
402456 var pos = 0 ;
0 commit comments