File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 22using SqlKata . Extensions ;
33using SqlKata . Tests . Infrastructure ;
44using System ;
5+ using System . Collections . Generic ;
56using Xunit ;
67
78namespace SqlKata . Tests
@@ -21,6 +22,19 @@ public void BasicSelect()
2122 Assert . Equal ( "SELECT \" id\" , \" name\" FROM \" users\" " , c [ EngineCodes . Oracle ] ) ;
2223 }
2324
25+ [ Fact ]
26+ public void BasicSelectEnumerable ( )
27+ {
28+ var q = new Query ( ) . From ( "users" ) . Select ( new List < string > ( ) { "id" , "name" } ) ;
29+ var c = Compile ( q ) ;
30+
31+ Assert . Equal ( "SELECT [id], [name] FROM [users]" , c [ EngineCodes . SqlServer ] ) ;
32+ Assert . Equal ( "SELECT `id`, `name` FROM `users`" , c [ EngineCodes . MySql ] ) ;
33+ Assert . Equal ( "SELECT \" id\" , \" name\" FROM \" users\" " , c [ EngineCodes . PostgreSql ] ) ;
34+ Assert . Equal ( "SELECT \" ID\" , \" NAME\" FROM \" USERS\" " , c [ EngineCodes . Firebird ] ) ;
35+ Assert . Equal ( "SELECT \" id\" , \" name\" FROM \" users\" " , c [ EngineCodes . Oracle ] ) ;
36+ }
37+
2438 [ Fact ]
2539 public void BasicSelectWhereBindingIsEmptyOrNull ( )
2640 {
Original file line number Diff line number Diff line change 11using System ;
2+ using System . Collections . Generic ;
23using System . Linq ;
34
45namespace SqlKata
@@ -7,6 +8,11 @@ public partial class Query
78 {
89
910 public Query Select ( params string [ ] columns )
11+ {
12+ return Select ( columns . AsEnumerable ( ) ) ;
13+ }
14+
15+ public Query Select ( IEnumerable < string > columns )
1016 {
1117 Method = "select" ;
1218
You can’t perform that action at this time.
0 commit comments