diff --git a/mommons-shared/src/main/java/cz/maku/mommons/storage/database/type/MySQL.java b/mommons-shared/src/main/java/cz/maku/mommons/storage/database/type/MySQL.java index 1fef3c0..a98ec9e 100644 --- a/mommons-shared/src/main/java/cz/maku/mommons/storage/database/type/MySQL.java +++ b/mommons-shared/src/main/java/cz/maku/mommons/storage/database/type/MySQL.java @@ -1,6 +1,7 @@ package cz.maku.mommons.storage.database.type; import cz.maku.mommons.storage.database.SQLRow; +import org.jetbrains.annotations.NotNull; import java.sql.*; import java.util.ArrayList; @@ -22,6 +23,15 @@ public MySQL(Connection connection) { instance = this; } + @NotNull + public static Connection connection() { + if (instance == null) { + throw new RuntimeException("MySQL is not initialized!"); + } + + return instance.getConnection(); + } + public static MySQL getApi() { return instance; }