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:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user