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

com.venky.swf.sql.Delete Maven / Gradle / Ivy

The newest version!
package com.venky.swf.sql;

import com.venky.swf.db.model.Model;
import com.venky.swf.db.model.reflection.ModelReflector;



public class Delete extends DataManupulationStatement {
	private String table ;
	public  Delete(ModelReflector ref){
		this(ref.getPool(),ref.getTableName());
	}
	
	public Delete(String pool,String table){
		super(pool);
		this.table = table;
	}
	@Override
	public void finalizeParameterizedSQL() {
		StringBuilder builder = getQuery();
		builder.append("DELETE FROM ").append(table);
		Expression where = getWhereExpression();
		if (where != null){
			builder.append(" WHERE ");
			builder.append(where.getParameterizedSQL());
			getValues().addAll(where.getValues());
		}
	}

	private Expression whereExpression ;
	public Delete where(Expression expression){
		this.whereExpression = expression;
		return this;
	}
	
	public Expression getWhereExpression(){
		return whereExpression;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy