com.jpattern.orm.query.sql.PlainSqlUpdateQuery Maven / Gradle / Ivy
package com.jpattern.orm.query.sql;
import com.jpattern.orm.session.SessionSqlPerformer;
import com.jpattern.orm.session.SqlPerformer;
/**
*
* @author Francesco Cina
*
* 09/lug/2011
*/
public class PlainSqlUpdateQuery implements SqlUpdateQuery {
/**
*
*/
private int queryTimeout = 0;
private final SessionSqlPerformer session;
private final String sql;
private final Object[] args;
public PlainSqlUpdateQuery(SessionSqlPerformer session, String sql, Object[] args) {
this.session = session;
this.sql = sql;
this.args = args;
}
@Override
public void execute() {
update();
}
@Override
public void setQueryTimeout(int queryTimeout) {
this.queryTimeout = queryTimeout;
}
@Override
public int getQueryTimeout() {
return queryTimeout;
}
@Override
public int update() {
SqlPerformer sqlExec = session.sqlPerformer();
sqlExec.setQueryTimeout(getQueryTimeout());
return sqlExec.update(sql , args);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy