Class batch insert and get last rowid before transaction end