Package bayern.steinbrecher.dbConnector
Class SimpleConnection
java.lang.Object
bayern.steinbrecher.dbConnector.DBConnection
bayern.steinbrecher.dbConnector.SimpleConnection
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class SimpleConnection extends DBConnection
- Since:
- 0.1
-
Nested Class Summary
Nested classes/interfaces inherited from class bayern.steinbrecher.dbConnector.DBConnection
DBConnection.Column<T>, DBConnection.Table<T,E> -
Constructor Summary
Constructors Constructor Description SimpleConnection(@NotNull SupportedDatabases dbms, @NotNull java.lang.String databaseHost, int databasePort, @NotNull java.lang.String databaseName, @NotNull SimpleCredentials credentials)SimpleConnection(@NotNull SupportedDatabases dbms, @NotNull java.lang.String databaseHost, int databasePort, @NotNull java.lang.String databaseName, @NotNull SimpleCredentials credentials, boolean useSSL) -
Method Summary
Modifier and Type Method Description voidclose()@NotNull java.util.List<java.util.List<java.lang.String>>execQuery(@NotNull java.lang.String sqlCode)Executes a query and returns the result.voidexecUpdate(@NotNull java.lang.String sqlCode)Executes a command like INSERT INTO, UPDATE or CREATE.Methods inherited from class bayern.steinbrecher.dbConnector.DBConnection
createTableIfNotExists, databaseExists, getAllColumns, getAllTables, getDatabaseName, getDbms, getMissingColumns, getTable, getTableContent, tableExists
-
Constructor Details
-
SimpleConnection
public SimpleConnection(@NotNull @NotNull SupportedDatabases dbms, @NotNull @NotNull java.lang.String databaseHost, int databasePort, @NotNull @NotNull java.lang.String databaseName, @NotNull @NotNull SimpleCredentials credentials, boolean useSSL) throws AuthException, DatabaseNotFoundException- Throws:
AuthExceptionDatabaseNotFoundException- Since:
- 0.10
-
SimpleConnection
public SimpleConnection(@NotNull @NotNull SupportedDatabases dbms, @NotNull @NotNull java.lang.String databaseHost, int databasePort, @NotNull @NotNull java.lang.String databaseName, @NotNull @NotNull SimpleCredentials credentials) throws AuthException, DatabaseNotFoundException- Throws:
AuthExceptionDatabaseNotFoundException- Since:
- 0.1
-
-
Method Details
-
execQuery
@NotNull public @NotNull java.util.List<java.util.List<java.lang.String>> execQuery(@NotNull @NotNull java.lang.String sqlCode) throws QueryFailedExceptionDescription copied from class:DBConnectionExecutes a query and returns the result.- Specified by:
execQueryin classDBConnection- Parameters:
sqlCode- The sql code to execute.- Returns:
- Table containing the results AND the headings of each column. First dimension rows; second columns.
- Throws:
QueryFailedException- Thrown if the sql code is invalid.- Since:
- 0.1
-
execUpdate
Description copied from class:DBConnectionExecutes a command like INSERT INTO, UPDATE or CREATE.- Specified by:
execUpdatein classDBConnection- Parameters:
sqlCode- The sql code to execute.- Throws:
QueryFailedException- Thrown if the sql code is invalid.- Since:
- 0.1
-
close
public void close()- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein classDBConnection- Since:
- 0.1
-