Table on DB:
TABLE ALBUM - ID_ON_DISCOGS (unique) - ARTIST_ID - LABEL_ID
I have to bulk insert records into this table.
The problem is that sometimes it could happen that the bulk insert tries to insert a record with a ID_ON_DISCOGS that is already present.
In that case I'd like to update the ARTIST_ID or the LABEL_ID fields with the new values.
Example:
ALBUM RECORD already in DB:
|ID_ON_DISCOGS | ARTIST_ID | LABEL_ID|
:------------------------------------:
|123 | 345 | null |
:------------------------------------:
ALBUM RECORD I try to insert:
|ID_ON_DISCOGS | ARTIST_ID | LABEL_ID|
:------------------------------------:
|123 | null | 567 |
:------------------------------------:
result record I'd like to achieve:
|ID_ON_DISCOGS | ARTIST_ID | LABEL_ID|
:------------------------------------:
|123 | 345 | 567 |
:------------------------------------:
Possibly a solution that could fit in a content provider.
Aucun commentaire:
Enregistrer un commentaire