Package de.murmelmeister.murmelapi.utils
Klasse Database
java.lang.Object
de.murmelmeister.murmelapi.utils.Database
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic voidConnects to the database using the provided URL, username and password.static voidconnect(String driver, String hostname, String port, String database, String username, String password) Connects to the database using the provided driver, host, port, database, username, and password.static voidDisconnects from the database and close the connection pool.static booleanExists the value in the database.static booleanExists the value in the database.static com.zaxxer.hikari.HikariDataSourcestatic doubleObtain the double value.static doubleObtain the double value.static floatObtain the float value.static floatObtain the float value.static intObtain the int value.static intObtain the int value.getIntList(List<Integer> list, String value, String sql) Obtain the int list.Obtain the int list.static longObtain the long value.static longObtain the long value.static StringObtain the string value.static StringObtain the string value.getStringList(List<String> list, String value, String sql) Obtain the string list.Obtain the string list.static UUIDgetUniqueId(UUID defaultValue, String value, String sql) Obtain the id.static UUIDgetUniqueId(UUID defaultValue, String value, String sql, Object... objects) Obtain the id.getUniqueIdList(List<UUID> list, String value, String sql) Obtain the id list.Obtain the id list.static <T> TObtain a value.static <T> List<T> Obtain a value list.static voidSend an update in the database.static voidUpdate the sql which theString.format(String, Object...).
-
Konstruktordetails
-
Database
public Database()
-
-
Methodendetails
-
connect
Connects to the database using the provided URL, username and password.- Parameter:
url- The JDBC URL for the database.user- The username for the database.password- The password for the database.
-
connect
public static void connect(String driver, String hostname, String port, String database, String username, String password) Connects to the database using the provided driver, host, port, database, username, and password.- Parameter:
driver- The JDBC driver for the database.hostname- The hostname of the database.port- The port of the database.database- The name of the database.username- The username for the database.password- The password for the database.
-
disconnect
public static void disconnect()Disconnects from the database and close the connection pool. -
update
Send an update in the database.- Parameter:
sql- SQL command- Löst aus:
SQLException
-
update
Update the sql which theString.format(String, Object...).- Parameter:
sql- SQL commandobjects-String.format(String, Object...)- Löst aus:
SQLException
-
getValue
public static <T> T getValue(T defaultValue, Class<T> type, String value, String sql) throws SQLException Obtain a value.- Typparameter:
T- Which type return- Parameter:
defaultValue- Set a default valuetype- Type what value havevalue- Value what you getsql- SQL command- Gibt zurück:
- A type what do you will to get
- Löst aus:
SQLException
-
getValues
public static <T> List<T> getValues(List<T> list, Class<T> type, String value, String sql) throws SQLException Obtain a value list.- Typparameter:
T- Which type return- Parameter:
list- Set a default listtype- Type what value havevalue- Value what you getsql- SQL command- Gibt zurück:
- A type list what do you will to get
- Löst aus:
SQLException
-
exists
Exists the value in the database.- Parameter:
sql- SQL command- Gibt zurück:
- True if exists the value
- Löst aus:
SQLException
-
exists
Exists the value in the database.- Parameter:
sql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- True if exists the value
- Löst aus:
SQLException
-
getString
Obtain the string value.- Parameter:
defaultValue- Set a default stringvalue- Value what you getsql- SQL command- Gibt zurück:
- A String what do you will to get
- Löst aus:
SQLException
-
getString
public static String getString(String defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the string value.- Parameter:
defaultValue- Set a default stringvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A String what do you will to get
- Löst aus:
SQLException
-
getInt
Obtain the int value.- Parameter:
defaultValue- Set a default intvalue- Value what you getsql- SQL command- Gibt zurück:
- An int what do you will to get
- Löst aus:
SQLException
-
getInt
public static int getInt(int defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the int value.- Parameter:
defaultValue- Set a default intvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- An int what do you will to get
- Löst aus:
SQLException
-
getLong
Obtain the long value.- Parameter:
defaultValue- Set a default longvalue- Value what you getsql- SQL command- Gibt zurück:
- A long what do you will to get
- Löst aus:
SQLException
-
getLong
public static long getLong(long defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the long value.- Parameter:
defaultValue- Set a default longvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A long what do you will to get
- Löst aus:
SQLException
-
getFloat
Obtain the float value.- Parameter:
defaultValue- Set a default floatvalue- Value what you getsql- SQL command- Gibt zurück:
- A float what do you will to get
- Löst aus:
SQLException
-
getFloat
public static float getFloat(float defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the float value.- Parameter:
defaultValue- Set a default floatvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A float what do you will to get
- Löst aus:
SQLException
-
getDouble
Obtain the double value.- Parameter:
defaultValue- Set a default doublevalue- Value what you getsql- SQL command- Gibt zurück:
- A double what do you will to get
- Löst aus:
SQLException
-
getDouble
public static double getDouble(double defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the double value.- Parameter:
defaultValue- Set a default doublevalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A double what do you will to get
- Löst aus:
SQLException
-
getUniqueId
Obtain the id.- Parameter:
defaultValue- Set a default idvalue- Value what you getsql- SQL command- Gibt zurück:
- A UniqueId what do you will to get
- Löst aus:
SQLException
-
getUniqueId
public static UUID getUniqueId(UUID defaultValue, String value, String sql, Object... objects) throws SQLException Obtain the id.- Parameter:
defaultValue- Set a default idvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A UniqueId what do you will to get
- Löst aus:
SQLException
-
getStringList
public static List<String> getStringList(List<String> list, String value, String sql) throws SQLException Obtain the string list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL command- Gibt zurück:
- A String list what do you will to get
- Löst aus:
SQLException
-
getStringList
public static List<String> getStringList(List<String> list, String value, String sql, Object... objects) throws SQLException Obtain the string list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A String list what do you will to get
- Löst aus:
SQLException
-
getIntList
public static List<Integer> getIntList(List<Integer> list, String value, String sql) throws SQLException Obtain the int list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL command- Gibt zurück:
- An int list what do you will to get
- Löst aus:
SQLException
-
getIntList
public static List<Integer> getIntList(List<Integer> list, String value, String sql, Object... objects) throws SQLException Obtain the int list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- An int list what do you will to get
- Löst aus:
SQLException
-
getUniqueIdList
public static List<UUID> getUniqueIdList(List<UUID> list, String value, String sql) throws SQLException Obtain the id list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL command- Gibt zurück:
- A UUID list what do you will to get
- Löst aus:
SQLException
-
getUniqueIdList
public static List<UUID> getUniqueIdList(List<UUID> list, String value, String sql, Object... objects) throws SQLException Obtain the id list.- Parameter:
list- Set a default listvalue- Value what you getsql- SQL commandobjects-String.format(String, Object...)- Gibt zurück:
- A UUID list what do you will to get
- Löst aus:
SQLException
-
getDataSource
public static com.zaxxer.hikari.HikariDataSource getDataSource()
-