Merge branch 'master' into DurationFieldInFightEndsPacket
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
YoyoNow 2023-05-10 17:07:12 +02:00
Commit 9df7ed39a4
4 geänderte Dateien mit 12 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -32,6 +32,10 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
public class Event { public class Event {
static {
SchematicType.Normal.name(); // Ensure SchematicType is loaded.
}
private static final Table<Event> table = new Table<>(Event.class); private static final Table<Event> table = new Table<>(Event.class);
private static final SelectStatement<Event> byCurrent = new SelectStatement<>(table, "SELECT * FROM Event WHERE Start < now() AND End > now()"); private static final SelectStatement<Event> byCurrent = new SelectStatement<>(table, "SELECT * FROM Event WHERE Start < now() AND End > now()");

Datei anzeigen

@ -26,7 +26,7 @@ import lombok.AllArgsConstructor;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
@AllArgsConstructor @AllArgsConstructor

Datei anzeigen

@ -20,9 +20,7 @@
package de.steamwar.sql; package de.steamwar.sql;
import de.steamwar.sql.internal.*; import de.steamwar.sql.internal.*;
import lombok.AccessLevel;
import lombok.Getter; import lombok.Getter;
import lombok.Setter;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.time.Instant; import java.time.Instant;
@ -32,6 +30,7 @@ import java.util.function.Predicate;
public class SchematicNode { public class SchematicNode {
static { static {
SchematicType.Normal.name(); // Ensure SchematicType is loaded.
new SqlTypeMapper<>(SchematicNode.class, null, (rs, identifier) -> { throw new SecurityException("SchematicNode cannot be used as type (recursive select)"); }, (st, index, value) -> st.setInt(index, value.nodeId)); new SqlTypeMapper<>(SchematicNode.class, null, (rs, identifier) -> { throw new SecurityException("SchematicNode cannot be used as type (recursive select)"); }, (st, index, value) -> st.setInt(index, value.nodeId));
} }

Datei anzeigen

@ -32,7 +32,12 @@ public final class SqlTypeMapper<T> {
private static final Map<Class<?>, SqlTypeMapper<?>> mappers = new IdentityHashMap<>(); private static final Map<Class<?>, SqlTypeMapper<?>> mappers = new IdentityHashMap<>();
public static <T> SqlTypeMapper<T> getMapper(Class<?> clazz) { public static <T> SqlTypeMapper<T> getMapper(Class<?> clazz) {
return (SqlTypeMapper<T>) mappers.get(clazz); SqlTypeMapper<T> result = (SqlTypeMapper<T>) mappers.get(clazz);
if(result == null)
throw new SecurityException("Unregistered mapper requested: " + clazz.getName());
return result;
} }
public static <T extends Enum<T>> void ordinalEnumMapper(Class<T> type) { public static <T extends Enum<T>> void ordinalEnumMapper(Class<T> type) {