Class QueryGenerator
java.lang.Object
bayern.steinbrecher.dbConnector.query.QueryGenerator
public class QueryGenerator
extends java.lang.Object
-
Method Summary
Modifier and Type Method Description @NotNull java.lang.StringgenerateCheckDatabaseExistenceStatement(@NotNull java.lang.String dbName)Since database connections currently (220-10-22) require to specify a database already on creation there not too much use in checking the existence of the database already connected to, i.e. this query is not too useful.@NotNull java.lang.StringgenerateCreateTableStatement(@NotNull java.lang.String dbName, @NotNull TableScheme<?,?> tableScheme)@NotNull java.lang.StringgenerateQueryColumnNamesAndTypesStatement(@NotNull java.lang.String dbName, DBConnection.Table<?,?> table)@NotNull java.lang.StringgenerateQueryTableNamesStatement(@NotNull java.lang.String dbName)@NotNull java.lang.StringgenerateSearchQueryStatement(@NotNull java.lang.String dbName, DBConnection.Table<?,?> table, @NotNull java.lang.Iterable<DBConnection.Column<?>> columnsToSelect, @NotNull java.lang.Iterable<QueryCondition<?>> conditions)@NotNull java.util.Optional<java.lang.String>getType(@NotNull java.lang.Class<?> columnType)@NotNull java.util.Optional<java.lang.Class<?>>getType(@NotNull java.lang.String sqlType)Returns the class used for representing values of the given SQL type.@NotNull java.lang.StringquoteIdentifier(@NotNull java.lang.String identifier)
-
Method Details
-
getType
@NotNull public @NotNull java.util.Optional<java.lang.Class<?>> getType(@NotNull @NotNull java.lang.String sqlType)Returns the class used for representing values of the given SQL type.- Parameters:
sqlType- The type to get a class for.- Returns:
- An
Optionalcontaining theClassrepresenting the appropriate SQL type. ReturnsOptional.empty()if and only if forsqlTypeno class is defined.
-
getType
@NotNull public @NotNull java.util.Optional<java.lang.String> getType(@NotNull @NotNull java.lang.Class<?> columnType) -
quoteIdentifier
@NotNull public @NotNull java.lang.String quoteIdentifier(@NotNull @NotNull java.lang.String identifier) -
generateCheckDatabaseExistenceStatement
@NotNull public @NotNull java.lang.String generateCheckDatabaseExistenceStatement(@NotNull @NotNull java.lang.String dbName) throws GenerationFailedExceptionSince database connections currently (220-10-22) require to specify a database already on creation there not too much use in checking the existence of the database already connected to, i.e. this query is not too useful.- Throws:
GenerationFailedException
-
generateCreateTableStatement
@NotNull public @NotNull java.lang.String generateCreateTableStatement(@NotNull @NotNull java.lang.String dbName, @NotNull @NotNull TableScheme<?,?> tableScheme) throws GenerationFailedException- Throws:
GenerationFailedException
-
generateQueryTableNamesStatement
@NotNull public @NotNull java.lang.String generateQueryTableNamesStatement(@NotNull @NotNull java.lang.String dbName) throws GenerationFailedException- Throws:
GenerationFailedException
-
generateQueryColumnNamesAndTypesStatement
@NotNull public @NotNull java.lang.String generateQueryColumnNamesAndTypesStatement(@NotNull @NotNull java.lang.String dbName, @NotNull DBConnection.Table<?,?> table) throws GenerationFailedException- Throws:
GenerationFailedException
-
generateSearchQueryStatement
@NotNull public @NotNull java.lang.String generateSearchQueryStatement(@NotNull @NotNull java.lang.String dbName, @NotNull DBConnection.Table<?,?> table, @NotNull @NotNull java.lang.Iterable<DBConnection.Column<?>> columnsToSelect, @NotNull @NotNull java.lang.Iterable<QueryCondition<?>> conditions) throws GenerationFailedException- Parameters:
columnsToSelect- If empty all columns are selected (SELECT *).conditions- List of conditions which is combined as conjunction.- Throws:
GenerationFailedException
-