com.jpattern.orm.query.sql.SqlUpdatePSCreator Maven / Gradle / Ivy
package com.jpattern.orm.query.sql;
import com.jpattern.orm.query.ISqlBatchUpdate;
import com.jpattern.orm.session.IPreparedStatementCreator;
import com.jpattern.orm.session.ISessionSqlPerformer;
import com.jpattern.orm.session.ISqlPerformer;
/**
*
* @author Francesco Cina
*
* 09/lug/2011
*/
public class SqlUpdatePSCreator implements ISqlBatchUpdate {
/**
*
*/
private int queryTimeout = 0;
private final ISessionSqlPerformer session;
private final String sql;
private final IPreparedStatementCreator psc;
public SqlUpdatePSCreator(ISessionSqlPerformer session, String sql, IPreparedStatementCreator psc) {
this.session = session;
this.sql = sql;
this.psc = psc;
}
@Override
public void execute() {
update();
}
@Override
public void setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
}
@Override
public int getQueryTimeout() {
return queryTimeout;
}
@Override
public int[] update() {
ISqlPerformer sqlExec = session.sqlPerformer();
sqlExec.setQueryTimeout(getQueryTimeout());
return sqlExec.batchUpdate(sql , psc);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy