@@ -45,10 +45,11 @@ public YdbList AddRow(params object?[] values)
4545 internal TypedValue ToTypedValue ( )
4646 {
4747 if ( _rows . Count == 0 && ( _types is null || _types . All ( t => t == YdbDbType . Unspecified ) ) )
48- throw new InvalidOperationException ( "Cannot infer Struct schema from an empty list without explicit YdbDbType hints." ) ;
48+ throw new InvalidOperationException (
49+ "Cannot infer Struct schema from an empty list without explicit YdbDbType hints." ) ;
4950
5051 var memberTypes = new Type [ _columns . Length ] ;
51- for ( int i = 0 ; i < _columns . Length ; i ++ )
52+ for ( var i = 0 ; i < _columns . Length ; i ++ )
5253 {
5354 if ( _types is not null && _types [ i ] != YdbDbType . Unspecified )
5455 {
@@ -60,8 +61,13 @@ internal TypedValue ToTypedValue()
6061 foreach ( var r in _rows )
6162 {
6263 var v = r [ i ] ;
63- if ( v is not null && v != DBNull . Value ) { sample = v ; break ; }
64+ if ( v is not null && v != DBNull . Value )
65+ {
66+ sample = v ;
67+ break ;
68+ }
6469 }
70+
6571 if ( sample is null )
6672 throw new InvalidOperationException (
6773 $ "Column '{ _columns [ i ] } ' has only nulls and no explicit YdbDbType. Provide a type hint.") ;
@@ -78,7 +84,7 @@ internal TypedValue ToTypedValue()
7884 foreach ( var r in _rows )
7985 {
8086 var fields = new List < Ydb . Value > ( _columns . Length ) ;
81- for ( int i = 0 ; i < _columns . Length ; i ++ )
87+ for ( var i = 0 ; i < _columns . Length ; i ++ )
8288 {
8389 var v = r [ i ] ;
8490 if ( v is null || v == DBNull . Value )
@@ -89,18 +95,19 @@ internal TypedValue ToTypedValue()
8995
9096 var tv = v switch
9197 {
92- YdbValue yv => yv . GetProto ( ) ,
98+ YdbValue yv => yv . GetProto ( ) ,
9399 YdbParameter p => p . TypedValue ,
94- _ => new YdbParameter { Value = v } . TypedValue
100+ _ => new YdbParameter { Value = v } . TypedValue
95101 } ;
96102 fields . Add ( tv . Value ) ;
97103 }
104+
98105 ydbRows . Add ( new Ydb . Value { Items = { fields } } ) ;
99106 }
100107
101108 return new TypedValue
102109 {
103- Type = new Type { ListType = new ListType { Item = new Type { StructType = structType } } } ,
110+ Type = new Type { ListType = new ListType { Item = new Type { StructType = structType } } } ,
104111 Value = new Ydb . Value { Items = { ydbRows } }
105112 } ;
106113 }
0 commit comments