Javier Julio <[EMAIL PROTECTED]> wrote:
> Reading that carefully I figure that means if I have a record in the
> ideas table with an ideaId of 5 and I perform an INSERT with that same
> ideaId of 5 (remember I always provide the id as I want to use the id
> from the server) then it removes that row, and replaces it with the
> newly provided one?

Correct.

> It seems I need to make sure I set a UNIQUE
> constraint on that ideaId field in my ideas table and not just set it
> as a PRIMARY KEY.

PRIMARY KEY implies UNIQUE.

> Does the INSERT OR REPLACE Internally figure out whether to do an
> INSERT or UPDATE? Maybe it does a delete and then an insert every
> time?

It tries to insert. If this results in a conflict, it deletes and then 
inserts again.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to