Skip to content
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
5 changes: 3 additions & 2 deletions query/src/main/java/com/blipblipcode/query/QueryDelete.kt
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ class QueryDelete private constructor(
}

override fun getSqlOperators(): List<SQLOperator<*>> {
return operations.values.map {
it.operator
return buildList {
add(where)
operations.values.forEach { add(it.operator) }
}
}

Expand Down
7 changes: 4 additions & 3 deletions query/src/main/java/com/blipblipcode/query/QuerySelect.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ class QuerySelect private constructor(
}

override fun getSqlOperators(): List<SQLOperator<*>> {
return operations.values.map {
it.operator
return buildList {
add(where)
operations.values.forEach { add(it.operator) }
}
}

Expand Down Expand Up @@ -319,7 +320,7 @@ class QuerySelect private constructor(
* @throws IllegalArgumentException if the WHERE clause is not set.
*/
fun build(): QuerySelect {
require(where != null) { "A WHERE clause must be specified." }
require(where != null) { "WHERE clause is required for QuerySelect" }
return QuerySelect(
where = where!!,
table = table,
Expand Down
2 changes: 1 addition & 1 deletion query/src/main/java/com/blipblipcode/query/QueryUpdate.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class QueryUpdate private constructor(
}

override fun getSqlOperators(): List<SQLOperator<*>> {
return emptyList()
return listOf(where)
}

override fun getTableName(): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class QueryDeleteTest {
@Test
fun `build without where clause throws exception`() {
val builder = QueryDelete.builder("users")
.and("status", SQLOperator.Equals("status", "active"))

assertThrows(IllegalArgumentException::class.java) {
builder.build()
Expand Down