@@ -123,18 +123,30 @@ public static FormatItem CreateForParameter(AseParameter parameter, DbEnvironmen
123123
124124 public static FormatItem ReadForRow ( Stream stream , Encoding enc , TokenType srcTokenType )
125125 {
126- var format = new FormatItem
126+ FormatItem format ;
127+ switch ( srcTokenType )
127128 {
128- ColumnLabel = stream . ReadByteLengthPrefixedString ( enc ) ,
129- CatalogName = stream . ReadByteLengthPrefixedString ( enc ) ,
130- SchemaName = stream . ReadByteLengthPrefixedString ( enc ) ,
131- TableName = stream . ReadByteLengthPrefixedString ( enc ) ,
132- ColumnName = stream . ReadByteLengthPrefixedString ( enc ) ,
133- RowStatus = ( RowFormatItemStatus ) ( srcTokenType == TokenType . TDS_ROWFMT
134- ? ( uint ) stream . ReadByte ( )
135- : stream . ReadUInt ( ) )
136- } ;
137-
129+ case TokenType . TDS_ROWFMT :
130+ format = new FormatItem
131+ {
132+ ColumnName = stream . ReadByteLengthPrefixedString ( enc ) ,
133+ RowStatus = ( RowFormatItemStatus ) stream . ReadByte ( )
134+ } ;
135+ break ;
136+ case TokenType . TDS_ROWFMT2 :
137+ format = new FormatItem
138+ {
139+ ColumnLabel = stream . ReadByteLengthPrefixedString ( enc ) ,
140+ CatalogName = stream . ReadByteLengthPrefixedString ( enc ) ,
141+ SchemaName = stream . ReadByteLengthPrefixedString ( enc ) ,
142+ TableName = stream . ReadByteLengthPrefixedString ( enc ) ,
143+ ColumnName = stream . ReadByteLengthPrefixedString ( enc ) ,
144+ RowStatus = ( RowFormatItemStatus ) stream . ReadUInt ( )
145+ } ;
146+ break ;
147+ default :
148+ throw new ArgumentException ( $ "Unexpected token type: { srcTokenType } .", nameof ( srcTokenType ) ) ;
149+ }
138150 ReadTypeInfo ( format , stream , enc ) ;
139151
140152 Logger . Instance ? . WriteLine ( $ " <- { format . ColumnName } : { format . DataType } (len: { format . Length } ) (ut:{ format . UserType } ) (status:{ format . RowStatus } ) (loc:{ format . LocaleInfo } ) format names available: ColumnLabel [{ format . ColumnLabel } ], ColumnName [{ format . ColumnName } ], CatalogName [{ format . CatalogName } ], ParameterName [{ format . ParameterName } ], SchemaName [{ format . SchemaName } ], TableName [{ format . TableName } ]") ;
0 commit comments