Fixed SQL for saving cookies. Handy syntax, that

"insert ... on duplicate key" stuff.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@125 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-11-15 20:48:49 +00:00
parent ccb530d8c7
commit 3dd3c857fa
@@ -116,9 +116,9 @@ public class GameCookieRepository extends SimpleRepository
} else {
PreparedStatement stmt = conn.prepareStatement(
"update GAME_COOKIES set COOKIE=?" +
" where GAME_ID=" + gameId +
" and USER_ID=" + userId);
"insert into GAME_COOKIES (GAME_ID, USER_ID, COOKIE) " +
"values (" + gameId + "," + userId + ",?) " +
"on duplicate key update COOKIE=values(COOKIE)");
try {
stmt.setBytes(1, cookie);
stmt.executeUpdate();