@@ -115,7 +115,7 @@ SELECT 1
115115 FROM (SELECT tuple(1, 'a', NULL) AS res)
116116 WHERE res.1 = tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 1)
117117 AND res.2 = tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 2)
118- AND res.3 is NULL
118+ AND res.3 is NULL
119119 AND tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 3) is NULL" ;
120120 using var command = connection . CreateCommand ( ) ;
121121 command . CommandText = sql ;
@@ -145,5 +145,43 @@ SELECT 1
145145 result . GetEnsureSingleRow ( ) ;
146146 }
147147
148+ [ Test ]
149+ public async Task ShouldExecuteSelectWithValueTupleParameter ( )
150+ {
151+ var sql = @"
152+ SELECT 1
153+ FROM (SELECT tuple(1, 'a', NULL) AS res)
154+ WHERE res.1 = tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 1)
155+ AND res.2 = tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 2)
156+ AND res.3 is NULL
157+ AND tupleElement({var:Tuple(Int32, String, Nullable(Int32))}, 3) is NULL" ;
158+ using var command = connection . CreateCommand ( ) ;
159+ command . CommandText = sql ;
160+
161+ command . AddParameter ( "var" , ValueTuple . Create < int , string , int ? > ( 1 , "a" , null ) ) ;
162+
163+ var result = await command . ExecuteReaderAsync ( ) ;
164+ result . GetEnsureSingleRow ( ) ;
165+ }
166+
167+ [ Test ]
168+ public async Task ShouldExecuteSelectWithUnderlyingValueTupleParameter ( )
169+ {
170+ var sql = @"
171+ SELECT 1
172+ FROM (SELECT tuple(123, tuple(5, 'a', 7)) AS res)
173+ WHERE res.1 = tupleElement({var:Tuple(Int32, Tuple(UInt8, String, Nullable(Int32)))}, 1)
174+ AND res.2.1 = tupleElement(tupleElement({var:Tuple(Int32, Tuple(UInt8, String, Nullable(Int32)))}, 2), 1)
175+ AND res.2.2 = tupleElement(tupleElement({var:Tuple(Int32, Tuple(UInt8, String, Nullable(Int32)))}, 2), 2)
176+ AND res.2.3 = tupleElement(tupleElement({var:Tuple(Int32, Tuple(UInt8, String, Nullable(Int32)))}, 2), 3)" ;
177+ using var command = connection . CreateCommand ( ) ;
178+ command . CommandText = sql ;
179+
180+ command . AddParameter ( "var" , ValueTuple . Create ( 123 , ValueTuple . Create ( ( byte ) 5 , "a" , 7 ) ) ) ;
181+
182+ var result = await command . ExecuteReaderAsync ( ) ;
183+ result . GetEnsureSingleRow ( ) ;
184+ }
185+
148186 public void Dispose ( ) => connection ? . Dispose ( ) ;
149187}
0 commit comments