I got sqlite DB on my android app to save reservations.
The one of the tables there contains the header of each reservation that may contain several parts of the reservation, each reservation has RES_ID while each part has PART_ID
the main table contains only the RES_ID as primary key, i have other tables that contains the parts in each of them PART_ID and RES_ID are both primary keys
i have a case in which i insert several part objects into the DB so eventually what happens is i try to insert a two or more rows with the same RES_ID to the table.
naturally i get SQLiteException, constrains violation since there’s already a row with that primary key.
Is there an SQL statement or a java method\const that will notify SQLite that failing is ok and i don
‘t want the exception ? (just for that table)
When I get your question right, you are looking for
insert or replace. Clickreplaceis a shortcut for this.