File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -194,5 +194,24 @@ public void UpdateFromQueryShouldFail()
194194
195195 }
196196
197+ [ Fact ]
198+ public void update_should_compile_literal_without_parameters_holders ( )
199+ {
200+
201+ var query = new Query ( "MyTable" ) . AsUpdate ( new
202+ {
203+ Name = "The User" ,
204+ Address = new UnsafeLiteral ( "@address" )
205+ } ) ;
206+
207+ var compiler = new SqlServerCompiler ( ) ;
208+ var result = compiler . Compile ( query ) ;
209+
210+ Assert . Equal (
211+ "UPDATE [MyTable] SET [Name] = ?, [Address] = @address" ,
212+ result . RawSql
213+ ) ;
214+ }
215+
197216 }
198217}
Original file line number Diff line number Diff line change @@ -291,11 +291,9 @@ private SqlResult CompileUpdateQuery(Query query)
291291
292292 for ( var i = 0 ; i < toUpdate . Columns . Count ; i ++ )
293293 {
294- parts . Add ( $ " { Wrap ( toUpdate . Columns [ i ] ) } = ?" ) ;
294+ parts . Add ( Wrap ( toUpdate . Columns [ i ] ) + " = " + Parameter ( ctx , toUpdate . Values [ i ] ) ) ;
295295 }
296296
297- ctx . Bindings . AddRange ( toUpdate . Values ) ;
298-
299297 var where = CompileWheres ( ctx ) ;
300298
301299 if ( ! string . IsNullOrEmpty ( where ) )
You can’t perform that action at this time.
0 commit comments