DatabasePreUpdateEvent

  • An event kind

    See more
  • The event kind

  • The database name

  • The table name

  • The number of columns in the row that is being inserted, updated, or deleted.

  • 1 for inserts, updates, or deletes invoked by top-level triggers; 2 for changes resulting from triggers called by top-level triggers; … and so forth

  • The initial rowID of the row being changed for .Update and .Delete changes, and nil for .Insert changes.

  • The final rowID of the row being changed for .Update and .Insert changes, and nil for .Delete changes.

  • The initial database values in the row.

    Values appear in the same order as the columns in the table.

    The result is nil if the event is an .Insert event.

  • Returns the initial DatabaseValue at given index.

    Indexes span from 0 for the leftmost column to (row.count - 1) for the righmost column.

    The result is nil if the event is an .Insert event.

  • The final database values in the row.

    Values appear in the same order as the columns in the table.

    The result is nil if the event is a .Delete event.

  • Returns the final DatabaseValue at given index.

    Indexes span from 0 for the leftmost column to (row.count - 1) for the righmost column.

    The result is nil if the event is a .Delete event.

  • Returns an event that can be stored:

    class MyObserver: TransactionObserver {
        var events: [DatabasePreUpdateEvent]
        func databaseWillChange(with event: DatabasePreUpdateEvent) {
            events.append(event.copy())
        }
    }