mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Test that order without limit is unused and harmless with updateAll() and deleteAll()
This commit is contained in:
1 parent
cb77fe2ed3
commit
218afa72c3
2 files changed
+8
-2
No files matched your search
@@ -166,12 +166,13 @@ class MutablePersistableRecordDeleteTests: GRDBTestCase {
|
||||
try Person.order(Column("name")).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\"")
|
||||
|
||||
// TODO: find out when ENABLE_UPDATE_DELETE_LIMIT is not there.
|
||||
// iOS8.1 can't run those tests, for example.
|
||||
if try String.fetchCursor(db, sql: "PRAGMA COMPILE_OPTIONS").contains("ENABLE_UPDATE_DELETE_LIMIT") {
|
||||
try Person.limit(1).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" LIMIT 1")
|
||||
|
||||
try Person.order(Column("name")).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" LIMIT 1")
|
||||
|
||||
try Person.order(Column("name")).limit(1).deleteAll(db)
|
||||
XCTAssertEqual(self.lastSQLQuery, "DELETE FROM \"persons\" ORDER BY \"name\" LIMIT 1")
|
||||
|
||||
|
||||
@@ -85,6 +85,11 @@ class MutablePersistableRecordUpdateTests: GRDBTestCase {
|
||||
UPDATE "player" SET "score" = 0 LIMIT 1
|
||||
""")
|
||||
|
||||
try Player.order(Columns.name).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
UPDATE "player" SET "score" = 0 LIMIT 1
|
||||
""")
|
||||
|
||||
try Player.order(Columns.name).limit(1).updateAll(db, assignment)
|
||||
XCTAssertEqual(self.lastSQLQuery, """
|
||||
UPDATE "player" SET "score" = 0 ORDER BY \"name\" LIMIT 1
|
||||
|
||||
Reference in new issue
Block a user