F
F
foonfyrick2020-10-29 07:34:43
android studio
foonfyrick, 2020-10-29 07:34:43

Room, after deleting a line and adding a new one, id is not reset, why?

I add several lines:
id 1-test,
id 2-test2,
id 3-test3
if I delete one line, and then add another one, it will turn out:
id 1-test,
id 2-test2,
id 4-test4
if I delete the entire database and add again:
id 5-test,
id 6-test2,
id 7-test3
Is this how it should be, or if I delete the first line, then the next added line goes to the place of the deleted id? And if I generally delete all the lines in the database, should everything be filled with id 1 or continue in ascending order (for example, the base was of 3 lines, deleted everything and when adding a new line, the first line with id4)?
I don't quite understand how this is supposed to work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Neonoviiwolf, 2020-10-30
@foonfyrick

everything works correctly if the database, when adding, will check which id is free, and you have 100 lyam records - the brakes are on a level. You are working with the Sqlite database, room only simplifies the work with it, the database itself decides what to give

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question