SQLite INSERT or UDATE with a custom condition
===

I know there is a lot of question already asked and answered on this subject but they don't seem to fit my situation.

I have a distant sqlite database — *DB server* — and a local one — *DB local* containing photo album entries. *DB local* updates whenever needed from *DB server*. *DB server* has a `primary key` called `identifier`, which is stored in *DB local* to prevent duplicates, but *DB local* also has its own `primary key` column called `id`

If I need to create a new album on my phone I insert an entry in *DB local* with `identifier` set to `-1` and when *DB server* will be reachable ask for a proper `identifier`.

My issue is : I do a lot of refresh and don't want to increment my primary key each time.

When I refresh *DB local* from *DB server* I would like to `INSERT` new albums, and `UPDATE` existing ones.

I read about the `INSERT OR REPLACE` statement but it would require my `identifier` column in *DB local* to be set as `unique`. Unfortunately I cannot do so since I can have multiple `identifier`set to `-1`.

Is there any way to perform an `INSERT` or `UPDATE` conditionally in a single request ?

Thanks !