limit

abstract fun limit(limit: Int): DeleteStatement<T>

Same as calling limit(limit, -1)


abstract fun limit(limit: Int, offset: Int): DeleteStatement<T>

Adds a LIMIT and optional OFFSET clause to the DELETE statement.

This function restricts the number of rows to be deleted. In SQLite, LIMIT is typically used with ORDER BY to delete a specific subset of rows, such as the oldest or newest entries.

This function can be called only once per DeleteStatement. Subsequent calls will override the previously set LIMIT and OFFSET.

Note: This is a non-standard SQL feature specific to SQLite.

Example:

// Deletes the 10 oldest log entries, skipping the first 5
LogTable.delete()
.orderBy(LogTable.timestamp, Sort.ASC)
.limit(10, 5) // Deletes 10 rows starting from the 6th oldest
.execute()

Return

The DeleteStatement instance for further chaining.

Author

MOHAMMAD AZIM ANSARI

Parameters

limit

The maximum number of rows to delete. A negative value means no limit.

offset

The number of rows to skip before starting to delete. A negative value means no offset (defaults to 0).

See also