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

com.github.napp.database.impl.Query Maven / Gradle / Ivy

There is a newer version: 1.1.8
Show newest version
/**
 *
 */
package com.github.napp.database.impl;

import com.github.napp.database.IEntity;


/**
 * @author Alexandru Bledea
 * @since Sep 21, 2013
 */
abstract class Query extends BaseQuery {

	protected static final String PLACEHOLDER = "?";

	private final String prefix;

	/**
	 * @param dao
	 * @param prefix
	 */
	Query(DAO dao, String prefix) {
		super(dao);
		this.prefix = prefix;
	}

	/* (non-Javadoc)
	 * @see com.github.napp.database.impl.Query#generate()
	 */
	@Override
	protected final String getSQL() {
		StringBuilder sb = new StringBuilder();
		sb.append(prefix);
		sb.append(dao.getTableName());
		addToQuery(sb);
		return sb.toString();
	}

	/**
	 * @param sb
	 */
	protected abstract void addToQuery(StringBuilder sb);

}