Заработало
This commit is contained in:
AidarKC
2025-12-18 15:37:28 +03:00
parent 4fb6b10a97
commit 1b1da19d3d
5 changed files with 58 additions and 84 deletions
@@ -8,7 +8,6 @@ import java.util.ArrayList;
import java.util.List;
/** Здесь зраним сохранённые параметры пользователей (в основном до каково сообщения просмотрены ленты) */
public final class UserParamsDAO {
private static volatile UserParamsDAO instance;
@@ -53,7 +52,9 @@ public final class UserParamsDAO {
signature = excluded.signature
""";
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
try (Connection c = db.getConnection();
PreparedStatement ps = c.prepareStatement(sql)) {
ps.setLong(1, param.getLoginId());
ps.setString(2, param.getParam());
ps.setLong(3, param.getBchChannelId());
@@ -82,7 +83,9 @@ public final class UserParamsDAO {
WHERE loginId = ? AND param = ?
""";
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
try (Connection c = db.getConnection();
PreparedStatement ps = c.prepareStatement(sql)) {
ps.setLong(1, loginId);
ps.setString(2, paramName);
try (ResultSet rs = ps.executeQuery()) {
@@ -112,7 +115,9 @@ public final class UserParamsDAO {
List<UserParamEntry> result = new ArrayList<>();
try (PreparedStatement ps = db.getConnection().prepareStatement(sql)) {
try (Connection c = db.getConnection();
PreparedStatement ps = c.prepareStatement(sql)) {
ps.setLong(1, loginId);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) result.add(mapRow(rs));
@@ -133,4 +138,4 @@ public final class UserParamsDAO {
rs.getString("signature")
);
}
}
}