Auto-create account in both MySQL and PG

This commit is contained in:
P0nk
2024-09-26 07:59:27 +02:00
parent bf9c02bc16
commit 647e67f6e8
13 changed files with 158 additions and 49 deletions

View File

@@ -9,6 +9,7 @@ import database.PgDatabaseConfig;
import database.PgDatabaseConnection;
import database.migration.FlywayRunner;
import database.monsterbook.MonsterCardRepository;
import org.jdbi.v3.core.Handle;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
@@ -120,10 +121,12 @@ class CharacterSaverTest {
SELECT level
FROM chr
WHERE id = :id""";
return pgConnection.getHandle().createQuery(sql)
.bind("id", chrId)
.mapTo(Integer.class)
.one();
try (Handle handle = pgConnection.getHandle()) {
return handle.createQuery(sql)
.bind("id", chrId)
.mapTo(Integer.class)
.one();
}
}
}