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

com.jpattern.orm.query.SqlExecutor Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package com.jpattern.orm.query;

import java.util.List;

import com.jpattern.orm.exception.OrmException;
import com.jpattern.orm.query.sql.SqlBatchUpdate;
import com.jpattern.orm.query.sql.SqlExecute;
import com.jpattern.orm.query.sql.SqlListBatchUpdate;
import com.jpattern.orm.query.sql.SqlQuery;
import com.jpattern.orm.query.sql.SqlUpdate;
import com.jpattern.orm.query.sql.SqlUpdateGKReader;
import com.jpattern.orm.query.sql.SqlUpdatePSCreator;
import com.jpattern.orm.session.IGeneratedKeyReader;
import com.jpattern.orm.session.IPreparedStatementCreator;
import com.jpattern.orm.session.ISessionSqlPerformer;

/**
 * 
 * @author Francesco Cina
 *
 * 09/lug/2011
 */
public class SqlExecutor implements ISqlExecutor {

	/**
	 * 
	 */
	
	private final ISessionSqlPerformer session;

	public SqlExecutor(ISessionSqlPerformer session) {
		this.session = session;
	}

	@Override
	public ISqlQuery findQuery(String sql, Object... args) {
		return new SqlQuery(session, sql, args);
	}

	@Override
	public ISqlExecute executeQuery(String sql) throws OrmException {
		return new SqlExecute(session, sql);
	}

	@Override
	public ISqlUpdate updateQuery(String sql, Object... args) throws OrmException {
		return new SqlUpdate(session, sql, args);
	}

	@Override
	public ISqlUpdate updateQuery(String sql, IGeneratedKeyReader generatedKeyReader, Object... args) throws OrmException {
		return new SqlUpdateGKReader(session, sql, generatedKeyReader, args);
	}

	@Override
	public ISqlBatchUpdate batchUpdate(List sqls) throws OrmException {
		return new SqlListBatchUpdate(session, sqls);
	}

	@Override
	public ISqlBatchUpdate batchUpdate(String sql, List args) throws OrmException {
		return new SqlBatchUpdate(session, sql, args);
	}

	@Override
	public ISqlBatchUpdate batchUpdate(String sql, IPreparedStatementCreator psc) throws OrmException {
		return new SqlUpdatePSCreator(session, sql, psc);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy