com.github.schlak.universalQB.Implementation.MySQL.StatementBuilder.MySQLDeleteBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of universalQB Show documentation
Show all versions of universalQB Show documentation
The java lib universalQB can be used to access different databases
using formalized objects. These objects got converted into a query matching to the
syntactical rules of the database management system
package com.github.schlak.universalQB.Implementation.MySQL.StatementBuilder;
import com.github.schlak.universalQB.Definition.Statements.BasicDeleteBuilder;
import com.github.schlak.universalQB.Exeptions.QueryBuildException;
import com.github.schlak.universalQB.Implementation.MySQL.GeneralObjects.MySQLConditionStack;
import com.github.schlak.universalQB.Implementation.MySQL.StatmentBoxes.MysqlDeleteBox;
import com.github.schlak.universalQB.ObjectRecycler;
/**
* Created by Jonas Schlak on 15.10.2016.
*/
public class MySQLDeleteBuilder extends BasicDeleteBuilder {
/**
* Instantiates a new {@link MySQLDeleteBuilder}.
*/
public MySQLDeleteBuilder() {
clean();
}
private void validate() throws QueryBuildException {
if (this.table == null)
throw new QueryBuildException("No tableName is set for the query");
}
@Override
public MysqlDeleteBox getStatementBox() throws QueryBuildException {
validate();
MysqlDeleteBox box = ObjectRecycler.getInstance(MysqlDeleteBox.class);
box.init(table, whereConditionStack);
return box;
}
@Override
public void clean() {
super.clean();
whereConditionStack = ObjectRecycler.getInstance(MySQLConditionStack.class);
}
}