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 { } else {
PreparedStatement stmt = conn.prepareStatement( PreparedStatement stmt = conn.prepareStatement(
"update GAME_COOKIES set COOKIE=?" + "insert into GAME_COOKIES (GAME_ID, USER_ID, COOKIE) " +
" where GAME_ID=" + gameId + "values (" + gameId + "," + userId + ",?) " +
" and USER_ID=" + userId); "on duplicate key update COOKIE=values(COOKIE)");
try { try {
stmt.setBytes(1, cookie); stmt.setBytes(1, cookie);
stmt.executeUpdate(); stmt.executeUpdate();