diff options
author | Vitaly Takmazov | 2017-12-22 12:50:05 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-12-22 12:50:05 +0300 |
commit | aedd466c0caf6a95bfebc2de10371bc944bec2c3 (patch) | |
tree | a45e53a42c96a81b8164d0dda3295bdeae77380b /juick-server-jdbc | |
parent | a28f045836c1f0cadbbfcbaf85cb03b7ed643039 (diff) |
jdbc: split updates
Diffstat (limited to 'juick-server-jdbc')
-rw-r--r-- | juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java index f579577f..0c53740d 100644 --- a/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/juick-server-jdbc/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -188,11 +188,15 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ new Object[]{mid, ridnew, uid, rid, attachment, txt}, new int[]{Types.INTEGER, Types.SMALLINT, Types.INTEGER, Types.SMALLINT, Types.CHAR, Types.VARCHAR}); - if (ridnew > 0) + if (ridnew > 0) { + getJdbcTemplate().update( + "UPDATE messages SET replies = replies + 1 WHERE message_id = ?", + mid); getJdbcTemplate().update( "UPDATE messages, (SELECT ts FROM replies) as r " + - "SET messages.replies = messages.replies + 1, messages.updated = r.ts WHERE message_id = ?", + "SET messages.updated = r.ts WHERE message_id = ?", mid); + } return ridnew; } |