Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoangchungk53qx1/54638cda9b9d89348652ce8de214a579 to your computer and use it in GitHub Desktop.
Save hoangchungk53qx1/54638cda9b9d89348652ce8de214a579 to your computer and use it in GitHub Desktop.
query_op
@Query("UPDATE leaderboard_db SET " +
"dbplayerPoints1 = CASE WHEN dbplayerName1 = :playerName THEN :newPoints ELSE dbplayerPoints1 END, " +
"dbplayerPoints2 = CASE WHEN dbplayerName2 = :playerName THEN :newPoints ELSE dbplayerPoints2 END, " +
"dbplayerPoints3 = CASE WHEN dbplayerName3 = :playerName THEN :newPoints ELSE dbplayerPoints3 END, " +
"dbplayerPoints4 = CASE WHEN dbplayerName4 = :playerName THEN :newPoints ELSE dbplayerPoints4 END, " +
"dbplayerPoints5 = CASE WHEN dbplayerName5 = :playerName THEN :newPoints ELSE dbplayerPoints5 END, " +
"dbplayerPoints6 = CASE WHEN dbplayerName6 = :playerName THEN :newPoints ELSE dbplayerPoints6 END, " +
"dbplayerPoints7 = CASE WHEN dbplayerName7 = :playerName THEN :newPoints ELSE dbplayerPoints7 END, " +
"dbplayerPoints8 = CASE WHEN dbplayerName8 = :playerName THEN :newPoints ELSE dbplayerPoints8 END, " +
"dbplayerPoints9 = CASE WHEN dbplayerName9 = :playerName THEN :newPoints ELSE dbplayerPoints9 END, " +
"dbplayerPoints10 = CASE WHEN dbplayerName10 = :playerName THEN :newPoints ELSE dbplayerPoints10 END, " +
"dbplayerPoints11 = CASE WHEN dbplayerName11 = :playerName THEN :newPoints ELSE dbplayerPoints11 END " +
"WHERE dbplayerName1 = :playerName OR " +
"dbplayerName2 = :playerName OR " +
"dbplayerName3 = :playerName OR " +
"dbplayerName4 = :playerName OR " +
"dbplayerName5 = :playerName OR " +
"dbplayerName6 = :playerName OR " +
"dbplayerName7 = :playerName OR " +
"dbplayerName8 = :playerName OR " +
"dbplayerName9 = :playerName OR " +
"dbplayerName10 = :playerName OR " +
"dbplayerName11 = :playerName")
void updatePlayerPoints(String playerName, String newPoints);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment