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

com.hfg.sql.jdbc.SQLStatementOptions Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.sql.jdbc;


import java.sql.SQLException;
import java.sql.Statement;

//------------------------------------------------------------------------------
/**
 Options for a JDBC SQL statement.
 
@author J. Alex Taylor, hairyfatguy.com
*/ //------------------------------------------------------------------------------ // com.hfg XML/HTML Coding Library // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com // [email protected] //------------------------------------------------------------------------------ public class SQLStatementOptions { private Integer mMaxFieldSize; private Integer mMaxRows; private Boolean mEscapeProcessing; private Integer mQueryTimeoutInSec; private Integer mFetchDirection; private Integer mFetchSize; private Boolean mPoolable; private Boolean mCloseOnCompletion; //--------------------------------------------------------------------------- public Integer getMaxFieldSize() { return mMaxFieldSize; } //--------------------------------------------------------------------------- public SQLStatementOptions setMaxFieldSize(Integer inValue) { mMaxFieldSize = inValue; return this; } //--------------------------------------------------------------------------- public Integer getMaxRows() { return mMaxRows; } //--------------------------------------------------------------------------- public SQLStatementOptions setMaxRows(Integer inValue) { mMaxRows = inValue; return this; } //--------------------------------------------------------------------------- public Boolean getEscapeProcessing() { return mEscapeProcessing; } //--------------------------------------------------------------------------- public SQLStatementOptions setEscapeProcessing(Boolean inValue) { mEscapeProcessing = inValue; return this; } //--------------------------------------------------------------------------- public Integer getQueryTimeout() { return mQueryTimeoutInSec; } //--------------------------------------------------------------------------- public SQLStatementOptions setQueryTimeout(Integer inValueInSec) { mQueryTimeoutInSec = inValueInSec; return this; } //--------------------------------------------------------------------------- public SQLStatementOptions setFetchDirection(Integer inValue) { mFetchDirection = inValue; return this; } //--------------------------------------------------------------------------- public Integer getFetchDirection() { return mFetchDirection; } //--------------------------------------------------------------------------- public SQLStatementOptions setFetchSize(Integer inValue) { mFetchSize = inValue; return this; } //--------------------------------------------------------------------------- public Integer getFetchSize() { return mFetchSize; } //--------------------------------------------------------------------------- public SQLStatementOptions setPoolable(Boolean inValue) { mPoolable = inValue; return this; } //--------------------------------------------------------------------------- public Boolean isPoolable() { return mPoolable; } //--------------------------------------------------------------------------- public SQLStatementOptions closeOnCompletion() { mCloseOnCompletion = true; return this; } //--------------------------------------------------------------------------- public Boolean isCloseOnCompletion() { return mCloseOnCompletion; } //--------------------------------------------------------------------------- public void configureStmt(Statement inStatement) throws SQLException { if (getMaxFieldSize() != null) { inStatement.setMaxFieldSize(getMaxFieldSize()); } if (getMaxRows() != null) { inStatement.setMaxRows(getMaxRows()); } if (getEscapeProcessing() != null) { inStatement.setEscapeProcessing(getEscapeProcessing()); } if (getQueryTimeout() != null) { inStatement.setQueryTimeout(getQueryTimeout()); } if (getFetchDirection() != null) { inStatement.setFetchDirection(getFetchDirection()); } if (getFetchSize() != null) { inStatement.setFetchSize(getFetchSize()); } if (isPoolable() != null) { inStatement.setPoolable(isPoolable()); } if (isCloseOnCompletion() != null && isCloseOnCompletion()) { inStatement.closeOnCompletion(); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy