Search code examples
kotlinkotlin-exposed

Getting the number of deleted rows in Kotlin's Exposed?


I currently have something along the lines of

transaction {
    FooTable.deleteWhere { FooTable.BarId eq 1 }
}

I want to see how many rows that it successfully deleted (I really just want to make sure there was an entry before and was deleted). Any ideas on how I can do that?


Solution

  • Try this:

    transaction {
       var numberOfDeletedItems = FooTable.deleteWhere { FooTable.BarId eq 1 }
    }