Class PreparedStatementImpl
- java.lang.Object
-
- org.teiid.jdbc.WrapperImpl
-
- org.teiid.jdbc.StatementImpl
-
- org.teiid.jdbc.PreparedStatementImpl
-
- All Implemented Interfaces:
AutoCloseable,PreparedStatement,Statement,Wrapper,TeiidPreparedStatement,TeiidStatement
- Direct Known Subclasses:
CallableStatementImpl
public class PreparedStatementImpl extends StatementImpl implements TeiidPreparedStatement
Instances of PreparedStatement contain a SQL statement that has already been compiled. The SQL statement contained in a PreparedStatement object may have one or more IN parameters. An IN parameter is a parameter whose value is not specified when a SQL statement is created. Instead the statement has a placeholder for each IN parameter.
The PreparedStatementImpl object wraps the server's PreparedStatement object. The methods in this class are used to set the IN parameters on a server's preparedstatement object.
-
-
Field Summary
Fields Modifier and Type Field Description protected List<List<Object>>batchParameterListprotected StringprepareSql-
Fields inherited from class org.teiid.jdbc.StatementImpl
commandStatus, currentRequestID, NEWINSTANCE, NO_TIMEOUT, outParamByName, outParamIndexMap, queryTimeoutMS, resultSet, updateCounts
-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatch()Adds a set of parameters to this PreparedStatement object's list of commands to be sent to the database for execution as a batch.voidaddBatch(String sql)voidclearBatch()Makes the set of commands in the current batch empty.voidclearParameters()Clears the values set for the PreparedStatement object's IN parameters and releases the resources used by those values.protected RequestMessagecreateRequestMessage(String[] commands, boolean isBatchedCommand, RequestMessage.ResultsMode resultsMode)booleanexecute()booleanexecute(String sql)booleanexecute(String sql, int autoGeneratedKeys)booleanexecute(String sql, int[] columnIndexes)booleanexecute(String sql, String[] columnNames)int[]executeBatch()ResultSetImplexecuteQuery()ResultSetexecuteQuery(String sql)intexecuteUpdate()intexecuteUpdate(String sql)intexecuteUpdate(String sql, int autoGeneratedKeys)intexecuteUpdate(String sql, int[] columnIndexes)intexecuteUpdate(String sql, String[] columnNames)ResultSetMetaDatagetMetaData()ParameterMetaDataImplgetParameterMetaData()voidsetArray(int parameterIndex, Array x)voidsetAsciiStream(int parameterIndex, InputStream x)voidsetAsciiStream(int parameterIndex, InputStream in, int length)voidsetAsciiStream(int parameterIndex, InputStream x, long length)voidsetAutoGeneratedKeys(boolean getAutoGeneratedKeys)voidsetBigDecimal(int parameterIndex, BigDecimal value)voidsetBinaryStream(int parameterIndex, InputStream x)voidsetBinaryStream(int parameterIndex, InputStream in, int length)voidsetBinaryStream(int parameterIndex, InputStream x, long length)voidsetBlob(int parameterIndex, InputStream inputStream)voidsetBlob(int parameterIndex, InputStream inputStream, long length)voidsetBlob(int parameterIndex, Blob x)voidsetBoolean(int parameterIndex, boolean value)voidsetByte(int parameterIndex, byte value)voidsetBytes(int parameterIndex, byte[] bytes)voidsetCharacterStream(int parameterIndex, Reader reader)voidsetCharacterStream(int parameterIndex, Reader reader, int length)voidsetCharacterStream(int parameterIndex, Reader reader, long length)voidsetClob(int parameterIndex, Reader reader)voidsetClob(int parameterIndex, Reader reader, long length)voidsetClob(int parameterIndex, Clob x)voidsetCommand(Object command)voidsetDate(int parameterIndex, Date value)voidsetDate(int parameterIndex, Date x, Calendar cal)voidsetDouble(int parameterIndex, double value)voidsetFloat(int parameterIndex, float value)voidsetInt(int parameterIndex, int value)voidsetLong(int parameterIndex, long value)voidsetNCharacterStream(int parameterIndex, Reader value)voidsetNCharacterStream(int parameterIndex, Reader value, long length)voidsetNClob(int parameterIndex, Reader reader)voidsetNClob(int parameterIndex, Reader reader, long length)voidsetNClob(int parameterIndex, NClob value)voidsetNString(int parameterIndex, String value)voidsetNull(int parameterIndex, int jdbcType)voidsetNull(int parameterIndex, int jdbcType, String typeName)voidsetObject(int parameterIndex, Object value)voidsetObject(int parameterIndex, Object value, int targetJdbcType)voidsetObject(int parameterIndex, Object value, int targetJdbcType, int scale)voidsetRef(int parameterIndex, Ref x)voidsetRowId(int parameterIndex, RowId x)voidsetShort(int parameterIndex, short value)voidsetSQLXML(int parameterIndex, SQLXML xmlObject)voidsetString(int parameterIndex, String value)voidsetTime(int parameterIndex, Time value)voidsetTime(int parameterIndex, Time x, Calendar cal)voidsetTimestamp(int parameterIndex, Timestamp value)voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal)voidsetUnicodeStream(int parameterIndex, InputStream x, int length)voidsetURL(int parameterIndex, URL x)voidsubmitExecute(String sql, StatementCallback callback, RequestOptions options)Execute the given statement using a non-blocking callback.ResultsFuture<Boolean>submitExecute(RequestMessage.ResultsMode mode, RequestOptions options)voidsubmitExecute(StatementCallback callback, RequestOptions options)Execute the given statement using a non-blocking callback.-
Methods inherited from class org.teiid.jdbc.StatementImpl
accumulateWarnings, booleanFuture, cancel, checkStatement, clearWarnings, close, closeOnCompletion, copyPropertiesToRequest, createResultSet, executeSql, executeSql, getAnnotations, getConnection, getDebugLog, getDQP, getExecutionProperty, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMMConnection, getMoreResults, getMoreResults, getPlanDescription, getQueryTimeout, getRequestIdentifier, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getServerTimeZone, getUpdateCount, getWarnings, hasResultSet, isClosed, isCloseOnCompletion, isPoolable, resetExecutionState, setAnalysisInfo, setCursorName, setEscapeProcessing, setExecutionProperty, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPayload, setPoolable, setQueryTimeout, submitExecute, timeoutOccurred
-
Methods inherited from class org.teiid.jdbc.WrapperImpl
isWrapperFor, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.PreparedStatement
executeLargeUpdate, setObject, setObject
-
Methods inherited from interface java.sql.Statement
cancel, clearWarnings, close, closeOnCompletion, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLargeMaxRows, getLargeUpdateCount, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setLargeMaxRows, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Method Detail
-
setAutoGeneratedKeys
public void setAutoGeneratedKeys(boolean getAutoGeneratedKeys)
-
addBatch
public void addBatch() throws SQLExceptionAdds a set of parameters to this PreparedStatement object's list of commands to be sent to the database for execution as a batch.
- Specified by:
addBatchin interfacePreparedStatement- Throws:
SQLException- if there is an error
-
clearBatch
public void clearBatch() throws SQLExceptionMakes the set of commands in the current batch empty.- Specified by:
clearBatchin interfaceStatement- Overrides:
clearBatchin classStatementImpl- Throws:
SQLException- if a database access error occurs or the driver does not support batch statements
-
clearParameters
public void clearParameters() throws SQLExceptionClears the values set for the PreparedStatement object's IN parameters and releases the resources used by those values. In general, parameter values remain in force for repeated use of statement.
- Specified by:
clearParametersin interfacePreparedStatement- Throws:
SQLException- if there is an error while clearing params
-
execute
public boolean execute(String sql) throws SQLException
- Specified by:
executein interfaceStatement- Overrides:
executein classStatementImpl- Throws:
SQLException
-
submitExecute
public void submitExecute(String sql, StatementCallback callback, RequestOptions options) throws TeiidSQLException
Description copied from interface:TeiidStatementExecute the given statement using a non-blocking callback. This method is only valid for use with embedded connections. Note that a single Statement may only have 1 asynch query executing at a time.- Specified by:
submitExecutein interfaceTeiidStatement- Overrides:
submitExecutein classStatementImpl- Throws:
TeiidSQLException
-
executeQuery
public ResultSet executeQuery(String sql) throws SQLException
- Specified by:
executeQueryin interfaceStatement- Overrides:
executeQueryin classStatementImpl- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classStatementImpl- Throws:
SQLException
-
execute
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executein interfaceStatement- Overrides:
executein classStatementImpl- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classStatementImpl- Throws:
SQLException
-
execute
public boolean execute(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executein interfaceStatement- Overrides:
executein classStatementImpl- Throws:
SQLException
-
execute
public boolean execute(String sql, String[] columnNames) throws SQLException
- Specified by:
executein interfaceStatement- Overrides:
executein classStatementImpl- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classStatementImpl- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, String[] columnNames) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Overrides:
executeUpdatein classStatementImpl- Throws:
SQLException
-
addBatch
public void addBatch(String sql) throws SQLException
- Specified by:
addBatchin interfaceStatement- Overrides:
addBatchin classStatementImpl- Throws:
SQLException
-
submitExecute
public void submitExecute(StatementCallback callback, RequestOptions options) throws SQLException
Description copied from interface:TeiidPreparedStatementExecute the given statement using a non-blocking callback. This method is only valid for use with embedded connections. Note that a single Statement may only have 1 asynch query executing at a time.- Specified by:
submitExecutein interfaceTeiidPreparedStatement- Throws:
SQLException
-
submitExecute
public ResultsFuture<Boolean> submitExecute(RequestMessage.ResultsMode mode, RequestOptions options) throws SQLException
- Throws:
SQLException
-
execute
public boolean execute() throws SQLException- Specified by:
executein interfacePreparedStatement- Throws:
SQLException
-
executeBatch
public int[] executeBatch() throws SQLException- Specified by:
executeBatchin interfaceStatement- Overrides:
executeBatchin classStatementImpl- Throws:
SQLException
-
executeQuery
public ResultSetImpl executeQuery() throws SQLException
- Specified by:
executeQueryin interfacePreparedStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate() throws SQLException- Specified by:
executeUpdatein interfacePreparedStatement- Throws:
SQLException
-
createRequestMessage
protected RequestMessage createRequestMessage(String[] commands, boolean isBatchedCommand, RequestMessage.ResultsMode resultsMode)
- Overrides:
createRequestMessagein classStatementImpl
-
getMetaData
public ResultSetMetaData getMetaData() throws SQLException
- Specified by:
getMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream in, int length) throws SQLException- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setBigDecimal
public void setBigDecimal(int parameterIndex, BigDecimal value) throws SQLException- Specified by:
setBigDecimalin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream in, int length) throws SQLException- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBlob
public void setBlob(int parameterIndex, Blob x) throws SQLException- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBoolean
public void setBoolean(int parameterIndex, boolean value) throws SQLException- Specified by:
setBooleanin interfacePreparedStatement- Throws:
SQLException
-
setByte
public void setByte(int parameterIndex, byte value) throws SQLException- Specified by:
setBytein interfacePreparedStatement- Throws:
SQLException
-
setBytes
public void setBytes(int parameterIndex, byte[] bytes) throws SQLException- Specified by:
setBytesin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setClob
public void setClob(int parameterIndex, Clob x) throws SQLException- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setDate
public void setDate(int parameterIndex, Date value) throws SQLException- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setDate
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException- Specified by:
setDatein interfacePreparedStatement- Throws:
SQLException
-
setDouble
public void setDouble(int parameterIndex, double value) throws SQLException- Specified by:
setDoublein interfacePreparedStatement- Throws:
SQLException
-
setFloat
public void setFloat(int parameterIndex, float value) throws SQLException- Specified by:
setFloatin interfacePreparedStatement- Throws:
SQLException
-
setInt
public void setInt(int parameterIndex, int value) throws SQLException- Specified by:
setIntin interfacePreparedStatement- Throws:
SQLException
-
setLong
public void setLong(int parameterIndex, long value) throws SQLException- Specified by:
setLongin interfacePreparedStatement- Throws:
SQLException
-
setNull
public void setNull(int parameterIndex, int jdbcType) throws SQLException- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setNull
public void setNull(int parameterIndex, int jdbcType, String typeName) throws SQLException- Specified by:
setNullin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, Object value, int targetJdbcType, int scale) throws SQLException- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, Object value, int targetJdbcType) throws SQLException- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setObject
public void setObject(int parameterIndex, Object value) throws SQLException- Specified by:
setObjectin interfacePreparedStatement- Throws:
SQLException
-
setShort
public void setShort(int parameterIndex, short value) throws SQLException- Specified by:
setShortin interfacePreparedStatement- Throws:
SQLException
-
setString
public void setString(int parameterIndex, String value) throws SQLException- Specified by:
setStringin interfacePreparedStatement- Throws:
SQLException
-
setTime
public void setTime(int parameterIndex, Time value) throws SQLException- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTime
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException- Specified by:
setTimein interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, Timestamp value) throws SQLException- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setTimestamp
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException- Specified by:
setTimestampin interfacePreparedStatement- Throws:
SQLException
-
setURL
public void setURL(int parameterIndex, URL x) throws SQLException- Specified by:
setURLin interfacePreparedStatement- Throws:
SQLException
-
getParameterMetaData
public ParameterMetaDataImpl getParameterMetaData() throws SQLException
- Specified by:
getParameterMetaDatain interfacePreparedStatement- Throws:
SQLException
-
setSQLXML
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException- Specified by:
setSQLXMLin interfacePreparedStatement- Throws:
SQLException
-
setArray
public void setArray(int parameterIndex, Array x) throws SQLException- Specified by:
setArrayin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException- Specified by:
setAsciiStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException- Specified by:
setBinaryStreamin interfacePreparedStatement- Throws:
SQLException
-
setBlob
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setBlob
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException- Specified by:
setBlobin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setCharacterStream
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException- Specified by:
setCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setClob
public void setClob(int parameterIndex, Reader reader) throws SQLException- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setClob
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException- Specified by:
setClobin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNCharacterStream
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException- Specified by:
setNCharacterStreamin interfacePreparedStatement- Throws:
SQLException
-
setNClob
public void setNClob(int parameterIndex, NClob value) throws SQLException- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
public void setNClob(int parameterIndex, Reader reader) throws SQLException- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNClob
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException- Specified by:
setNClobin interfacePreparedStatement- Throws:
SQLException
-
setNString
public void setNString(int parameterIndex, String value) throws SQLException- Specified by:
setNStringin interfacePreparedStatement- Throws:
SQLException
-
setRef
public void setRef(int parameterIndex, Ref x) throws SQLException- Specified by:
setRefin interfacePreparedStatement- Throws:
SQLException
-
setRowId
public void setRowId(int parameterIndex, RowId x) throws SQLException- Specified by:
setRowIdin interfacePreparedStatement- Throws:
SQLException
-
setUnicodeStream
public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException- Specified by:
setUnicodeStreamin interfacePreparedStatement- Throws:
SQLException
-
setCommand
public void setCommand(Object command)
-
-