Skip to content
Discussion options

You must be logged in to vote

@xorock the upsert function returns what the database engine returns for upserts. This can be specific to the DB engine you're using because upserts aren't really SQL standards.

So, for instance, if you're using mysql, here's how it calculates the number of affected rows (direct quote from docs):

With ON DUPLICATE KEY UPDATE, the affected-rows value per row is 1 if the row is inserted as a new row, 2 if an existing row is updated, and 0 if an existing row is set to its current values.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@anstapol
Comment options

Answer selected by xorock
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants