Skip to content

Commit fd946ac

Browse files
committed
Merge pull request #363 from hiltonc/namespace_star
Fix namespacing all of a table's columns using *
2 parents 345ef9b + c76c7e8 commit fd946ac

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

SQLite/Typed/Query.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ extension SchemaType {
5050
/// - Parameter all: A list of expressions to select.
5151
///
5252
/// - Returns: A query with the given `SELECT` clause applied.
53-
public func select(column1: Expressible, _ column2: Expressible, _ more: Expressible...) -> Self {
54-
return select(false, [column1, column2] + more)
53+
public func select(column1: Expressible, _ more: Expressible...) -> Self {
54+
return select(false, [column1] + more)
5555
}
5656

5757
/// Builds a copy of the query with the `SELECT DISTINCT` clause applied.
@@ -65,8 +65,8 @@ extension SchemaType {
6565
/// - Parameter columns: A list of expressions to select.
6666
///
6767
/// - Returns: A query with the given `SELECT DISTINCT` clause applied.
68-
public func select(distinct column1: Expressible, _ column2: Expressible, _ more: Expressible...) -> Self {
69-
return select(true, [column1, column2] + more)
68+
public func select(distinct column1: Expressible, _ more: Expressible...) -> Self {
69+
return select(true, [column1] + more)
7070
}
7171

7272
/// Builds a copy of the query with the `SELECT` clause applied.

SQLiteTests/QueryTests.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ class QueryTests : XCTestCase {
2020
func test_select_withExpression_compilesSelectClause() {
2121
AssertSQL("SELECT \"email\" FROM \"users\"", users.select(email))
2222
}
23+
24+
func test_select_withStarExpression_compilesSelectClause() {
25+
AssertSQL("SELECT * FROM \"users\"", users.select(*))
26+
}
27+
28+
func test_select_withNamespacedStarExpression_compilesSelectClause() {
29+
AssertSQL("SELECT \"users\".* FROM \"users\"", users.select(users[*]))
30+
}
2331

2432
func test_select_withVariadicExpressions_compilesSelectClause() {
2533
AssertSQL("SELECT \"email\", count(*) FROM \"users\"", users.select(email, count(*)))

0 commit comments

Comments
 (0)