Skip to content

Fix namespacing all of a table's columns using * #363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions SQLite/Typed/Query.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ extension SchemaType {
/// - Parameter all: A list of expressions to select.
///
/// - Returns: A query with the given `SELECT` clause applied.
public func select(column1: Expressible, _ column2: Expressible, _ more: Expressible...) -> Self {
return select(false, [column1, column2] + more)
public func select(column1: Expressible, _ more: Expressible...) -> Self {
return select(false, [column1] + more)
}

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

/// Builds a copy of the query with the `SELECT` clause applied.
Expand Down
8 changes: 8 additions & 0 deletions SQLiteTests/QueryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ class QueryTests : XCTestCase {
func test_select_withExpression_compilesSelectClause() {
AssertSQL("SELECT \"email\" FROM \"users\"", users.select(email))
}

func test_select_withStarExpression_compilesSelectClause() {
AssertSQL("SELECT * FROM \"users\"", users.select(*))
}

func test_select_withNamespacedStarExpression_compilesSelectClause() {
AssertSQL("SELECT \"users\".* FROM \"users\"", users.select(users[*]))
}

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