| Revision | 91 (tree) |
|---|---|
| Time | 2015-08-23 14:59:44 |
| Author | t_nakayama1971 |
(empty log message)
| @@ -14,7 +14,6 @@ | ||
| 14 | 14 | import common.db.jdbc.Jdbc; |
| 15 | 15 | import common.master.IntervalTimer.IntervalCache; |
| 16 | 16 | import common.sql.QueryUtil; |
| 17 | - | |
| 18 | 17 | import core.exception.PhysicalException; |
| 19 | 18 | import core.exception.ThrowableUtil; |
| 20 | 19 | import core.util.MapUtil; |
| @@ -106,8 +105,9 @@ | ||
| 106 | 105 | private List<Code> setCodeList(final String kbn) { |
| 107 | 106 | try (Jdbc conn = JdbcSource.getConnection()) { |
| 108 | 107 | String query = QueryUtil.getSqlFromFile("SEL_MS_CODE", this.getClass()); |
| 109 | - try (PreparedStatement psmt = QueryUtil.statementReadonly( | |
| 110 | - conn, query, Collections.singletonMap("SbCode", kbn))) { | |
| 108 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 109 | + query, Collections.singletonMap("SbCode", kbn), | |
| 110 | + Jdbc.wrap(conn)::readonlyStatement)) { | |
| 111 | 111 | |
| 112 | 112 | List<Code> l = null; |
| 113 | 113 | try (ResultSet rs = psmt.executeQuery()) { |
| @@ -11,8 +11,6 @@ | ||
| 11 | 11 | import java.util.Map; |
| 12 | 12 | import java.util.Objects; |
| 13 | 13 | |
| 14 | -import project.common.CodecUtil; | |
| 15 | -import project.common.StringUtil; | |
| 16 | 14 | import common.db.JdbcSource; |
| 17 | 15 | import common.db.jdbc.Jdbc; |
| 18 | 16 | import common.sql.QueryUtil; |
| @@ -19,6 +17,8 @@ | ||
| 19 | 17 | import core.exception.PhysicalException; |
| 20 | 18 | import core.exception.ThrowableUtil; |
| 21 | 19 | import core.util.DateUtil; |
| 20 | +import project.common.CodecUtil; | |
| 21 | +import project.common.StringUtil; | |
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * 認証クラス |
| @@ -90,7 +90,8 @@ | ||
| 90 | 90 | SessionInfo m = getSessionKanriInfoWithLock(uid, conn); |
| 91 | 91 | if (m == null) { |
| 92 | 92 | String query = QueryUtil.getSqlFromFile("InsertSessionKanri", this.getClass()); |
| 93 | - try (PreparedStatement upsmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 93 | + try (PreparedStatement upsmt = QueryUtil.createStatement( | |
| 94 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 94 | 95 | upsmt.executeUpdate(); |
| 95 | 96 | } |
| 96 | 97 | m = new SessionInfo(); |
| @@ -106,7 +107,8 @@ | ||
| 106 | 107 | param.put("LogoffSbt", Integer.valueOf(m.getLogoffType().value())); |
| 107 | 108 | |
| 108 | 109 | String query = QueryUtil.getSqlFromFile("UpdateSessionKanri", this.getClass()); |
| 109 | - try (PreparedStatement upsmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 110 | + try (PreparedStatement upsmt = QueryUtil.createStatement( | |
| 111 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 110 | 112 | upsmt.executeUpdate(); |
| 111 | 113 | } |
| 112 | 114 | } |
| @@ -145,7 +147,8 @@ | ||
| 145 | 147 | param.put("LogoffSbt", Integer.valueOf(m.getLogoffType().value())); |
| 146 | 148 | |
| 147 | 149 | String query = QueryUtil.getSqlFromFile("UpdateSessionKanri", this.getClass()); |
| 148 | - try (PreparedStatement psmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 150 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 151 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 149 | 152 | psmt.executeUpdate(); |
| 150 | 153 | } |
| 151 | 154 | conn.commit(); |
| @@ -174,7 +177,8 @@ | ||
| 174 | 177 | param.put("ShoriDtm", DateUtil.toDateTime(now)); |
| 175 | 178 | |
| 176 | 179 | String query = QueryUtil.getSqlFromFile("UpdateShoriDtm", this.getClass()); |
| 177 | - try (PreparedStatement psmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 180 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 181 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 178 | 182 | // 更新 |
| 179 | 183 | psmt.executeUpdate(); |
| 180 | 184 | } |
| @@ -272,8 +276,9 @@ | ||
| 272 | 276 | try (Jdbc conn = JdbcSource.getConnection()) { |
| 273 | 277 | // ユーザ存在確認 |
| 274 | 278 | String query = QueryUtil.getSqlFromFile("SelectUserInfo", this.getClass()); |
| 275 | - try (PreparedStatement psmt = QueryUtil.statementReadonly( | |
| 276 | - conn, query, Collections.singletonMap("UserId", uid))) { | |
| 279 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 280 | + query, Collections.singletonMap("UserId", uid), | |
| 281 | + Jdbc.wrap(conn)::readonlyStatement)) { | |
| 277 | 282 | try (ResultSet rs = psmt.executeQuery()) { |
| 278 | 283 | if (!rs.next()) { |
| 279 | 284 | return false; |
| @@ -286,7 +291,8 @@ | ||
| 286 | 291 | param.put("PassWd", CodecUtil.toMd5String(pwd)); |
| 287 | 292 | |
| 288 | 293 | // パスワード確認 |
| 289 | - try (PreparedStatement psmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 294 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 295 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 290 | 296 | try (ResultSet rs = psmt.executeQuery()) { |
| 291 | 297 | return rs.next(); |
| 292 | 298 | } |
| @@ -331,7 +337,8 @@ | ||
| 331 | 337 | param.put("Ticket", val); |
| 332 | 338 | |
| 333 | 339 | String query = QueryUtil.getSqlFromFile("UpdateTicket", this.getClass()); |
| 334 | - try (PreparedStatement psmt = QueryUtil.statementExecute(conn, query, param)) { | |
| 340 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 341 | + query, param, Jdbc.wrap(conn)::prepareStatement)) { | |
| 335 | 342 | int cnt = psmt.executeUpdate(); |
| 336 | 343 | if (cnt == 1) { |
| 337 | 344 | conn.commit(); |
| @@ -354,8 +361,9 @@ | ||
| 354 | 361 | if (!Objects.toString(uid, "").isEmpty()) { |
| 355 | 362 | try (Connection conn = JdbcSource.getConnection()) { |
| 356 | 363 | String query = QueryUtil.getSqlFromFile("SelectSessionKanri", this.getClass()); |
| 357 | - try (PreparedStatement psmt = QueryUtil.statementReadonly( | |
| 358 | - conn, query, Collections.singletonMap("UserId", uid))) { | |
| 364 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 365 | + query, Collections.singletonMap("UserId", uid), | |
| 366 | + Jdbc.wrap(conn)::readonlyStatement)) { | |
| 359 | 367 | try (ResultSet rs = psmt.executeQuery()) { |
| 360 | 368 | if (rs.next()) { |
| 361 | 369 | return toSessionInfo(rs); |
| @@ -380,8 +388,9 @@ | ||
| 380 | 388 | private SessionInfo getSessionKanriInfoWithLock(final String uid, final Connection conn) { |
| 381 | 389 | if (!Objects.toString(uid, "").isEmpty()) { |
| 382 | 390 | String query = QueryUtil.getSqlFromFile("SelectSessionKanriForUpdate", this.getClass()); |
| 383 | - try (PreparedStatement psmt = QueryUtil.statementReadonly( | |
| 384 | - conn, query, Collections.singletonMap("UserId", uid))) { | |
| 391 | + try (PreparedStatement psmt = QueryUtil.createStatement( | |
| 392 | + query, Collections.singletonMap("UserId", uid), | |
| 393 | + Jdbc.wrap(conn)::readonlyStatement)) { | |
| 385 | 394 | try (ResultSet rs = psmt.executeQuery()) { |
| 386 | 395 | if (rs.next()) { |
| 387 | 396 | toSessionInfo(rs); |