Skip to content

Commit c7f74da

Browse files
committed
fix the rest of the tests
1 parent c5476f5 commit c7f74da

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

SQLitePCL.pretty.Orm/SqlQuery.From.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using System.Linq.Expressions;
34

45
using SQLitePCL.pretty.Orm.Attributes;
@@ -18,7 +19,9 @@ internal FromClause(string table)
1819

1920
public WhereClause<T> Select()
2021
{
21-
return new WhereClause<T>(this, Expression.Constant("*"), null);
22+
var table = TableMapping.Create<T>();
23+
var columns = table.Columns.Keys.Select(col => table.TableName + "." + col).ToList();
24+
return new WhereClause<T>(this, columns, null);
2225
}
2326

2427
public override string ToString()

SQLitePCL.pretty.Orm/SqlQuery.Where.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ public static partial class SqlQuery
1313
public sealed class WhereClause<T> : ISqlQuery
1414
{
1515
private readonly FromClause<T> from;
16-
private readonly Expression select;
16+
17+
// FIXME: Long term, prefer some sort of expression syntax
18+
private readonly IReadOnlyList<String> select;
1719
private readonly Expression where;
1820

19-
internal WhereClause(FromClause<T> from, Expression select, Expression where)
21+
internal WhereClause(FromClause<T> from, IReadOnlyList<String> select, Expression where)
2022
{
2123
this.from = from;
2224
this.select = select;
@@ -130,7 +132,7 @@ public LimitClause<T> ElementAt(int index)
130132
public override string ToString()
131133
{
132134
return
133-
"SELECT " + select.CompileWhereExpr() +
135+
"SELECT " + string.Join(", ", select) +
134136
"\r\n" + from.ToString() +
135137
(where != null ? "\r\nWHERE " + where.CompileWhereExpr() : "");
136138
}

0 commit comments

Comments
 (0)