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

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

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

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Arrays;

import com.github.napp.database.IFreeQuery;

/**
 * @author Alexandru Bledea
 * @since Sep 22, 2013
 */
class FreeQuery extends BaseQuery implements IFreeQuery {

	/**
	 * @param dao
	 */
	FreeQuery(DAO dao) {
		super(dao);
	}

	private String sql;

	/* (non-Javadoc)
	 * @see com.github.napp.database.impl.IFreeQuery#setSQL(java.lang.String, java.lang.Object)
	 */
	@Override
	public void setSQL(String sql, Object... args) {
		this.sql = sql;
		setArgs(args);
	}

	/* (non-Javadoc)
	 * @see com.github.napp.database.impl.IFreeQuery#setArgs(java.lang.Object)
	 */
	@Override
	public void setArgs(Object... args) {
		this.args.clear();
		this.args.addAll(Arrays.asList(args));
	}

	/* (non-Javadoc)
	 * @see com.github.napp.database.impl.BaseQuery#getSQL()
	 */
	@Override
	protected String getSQL() {
		return sql;
	}

	/* (non-Javadoc)
	 * @see com.github.napp.database.impl.BaseQuery#setArguments(java.sql.PreparedStatement)
	 */
	@Override
	protected void setArguments(PreparedStatement ps) throws SQLException {
		addAll(ps, args);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy