All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.schlak.universalQB.Implementation.MySQL.StatementBuilder.MySQLDeleteBuilder Maven / Gradle / Ivy

Go to download

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

There is a newer version: 0.6.4
Show newest version
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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy