🛠️ Code cleanup & added many new features #1

Merged
gnmyt merged 121 commits from features/code-cleanup into master 2021-09-02 13:34:00 +00:00
Showing only changes of commit fb6b1d3a7d - Show all commits

View File

@ -0,0 +1,47 @@
package de.gnmyt.sqltoolkit.querybuilder;
import de.gnmyt.sqltoolkit.drivers.MySQLConnection;
import org.slf4j.Logger;
public class QueryBuilder {
private static final Logger LOG = MySQLConnection.LOG;
private AbstractQuery query;
/**
* Basic constructor of the {@link QueryBuilder}
*
* @param queryType The type of the query you want to generate
*/
public QueryBuilder(Class<? extends AbstractQuery> queryType) {
try {
query = queryType.newInstance();
} catch (Exception e) {
LOG.error("Could not initialize query: " + e.getMessage());
}
}
/**
* Adds a parameter to the building list
*
* @param type The type you want to use
* @param value The value of the type
* @return this class
*/
public QueryBuilder addParameter(QueryParameter type, Object value) {
query.addParameter(type, value);
return this;
}
/**
* Builds the query
*
* @return the built query
*/
public SQLQuery build() {
return query.build();
}
}