public class JdbcPreparedStatement extends JdbcStatement implements PreparedStatement
Modifier and Type | Field and Description |
---|---|
protected CommandInterface |
command |
closedByResultSet, conn, fetchSize, maxRows, resultSet, resultSetConcurrency, resultSetType, session, updateCount
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQL_EXCEPTION, STATEMENT, trace, XA_DATA_SOURCE, XA_RESOURCE, XID
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
Modifier and Type | Method and Description |
---|---|
void |
addBatch()
Adds the current settings to the batch.
|
void |
addBatch(String sql)
Calling this method is not legal on a PreparedStatement.
|
protected boolean |
checkClosed(boolean write)
INTERNAL.
|
void |
clearBatch()
Clears the batch.
|
void |
clearParameters()
Clears all parameters.
|
void |
close()
Closes this statement.
|
boolean |
execute()
Executes an arbitrary statement.
|
boolean |
execute(String sql)
Calling this method is not legal on a PreparedStatement.
|
boolean |
execute(String sql,
int autoGeneratedKeys)
Calling this method is not legal on a PreparedStatement.
|
boolean |
execute(String sql,
int[] columnIndexes)
Calling this method is not legal on a PreparedStatement.
|
boolean |
execute(String sql,
String[] columnNames)
Calling this method is not legal on a PreparedStatement.
|
int[] |
executeBatch()
Executes the batch.
|
ResultSet |
executeQuery()
Executes a query (select statement) and returns the result set.
|
ResultSet |
executeQuery(String sql)
Calling this method is not legal on a PreparedStatement.
|
int |
executeUpdate()
Executes a statement (insert, update, delete, create, drop)
and returns the update count.
|
int |
executeUpdate(String sql)
Calling this method is not legal on a PreparedStatement.
|
int |
executeUpdate(String sql,
int autoGeneratedKeys)
Calling this method is not legal on a PreparedStatement.
|
int |
executeUpdate(String sql,
int[] columnIndexes)
Calling this method is not legal on a PreparedStatement.
|
int |
executeUpdate(String sql,
String[] columnNames)
Calling this method is not legal on a PreparedStatement.
|
ResultSetMetaData |
getMetaData()
Gets the result set metadata of the query returned when the statement is
executed.
|
ParameterMetaData |
getParameterMetaData()
Get the parameter meta data of this prepared statement.
|
void |
setArray(int parameterIndex,
Array x)
[Not supported] Sets the value of a parameter as a Array.
|
void |
setAsciiStream(int parameterIndex,
InputStream x)
Sets the value of a parameter as an ASCII stream.
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
int length)
Sets the value of a parameter as an ASCII stream.
|
void |
setAsciiStream(int parameterIndex,
InputStream x,
long length)
Sets the value of a parameter as an ASCII stream.
|
void |
setBigDecimal(int parameterIndex,
BigDecimal x)
Sets the value of a parameter.
|
void |
setBinaryStream(int parameterIndex,
InputStream x)
Sets the value of a parameter as an input stream.
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
int length)
Sets the value of a parameter as an input stream.
|
void |
setBinaryStream(int parameterIndex,
InputStream x,
long length)
Sets the value of a parameter as an input stream.
|
void |
setBlob(int parameterIndex,
Blob x)
Sets the value of a parameter as a Blob.
|
void |
setBlob(int parameterIndex,
InputStream x)
Sets the value of a parameter as a Blob.
|
void |
setBlob(int parameterIndex,
InputStream x,
long length)
Sets the value of a parameter as a Blob.
|
void |
setBoolean(int parameterIndex,
boolean x)
Sets the value of a parameter.
|
void |
setByte(int parameterIndex,
byte x)
Sets the value of a parameter.
|
void |
setBytes(int parameterIndex,
byte[] x)
Sets the value of a parameter as a byte array.
|
void |
setCharacterStream(int parameterIndex,
Reader x)
Sets the value of a parameter as a character stream.
|
void |
setCharacterStream(int parameterIndex,
Reader x,
int length)
Sets the value of a parameter as a character stream.
|
void |
setCharacterStream(int parameterIndex,
Reader x,
long length)
Sets the value of a parameter as a character stream.
|
void |
setClob(int parameterIndex,
Clob x)
Sets the value of a parameter as a Clob.
|
void |
setClob(int parameterIndex,
Reader x)
Sets the value of a parameter as a Clob.
|
void |
setClob(int parameterIndex,
Reader x,
long length)
Sets the value of a parameter as a Clob.
|
void |
setDate(int parameterIndex,
Date x)
Sets the value of a parameter.
|
void |
setDate(int parameterIndex,
Date x,
Calendar calendar)
Sets the date using a specified time zone.
|
void |
setDouble(int parameterIndex,
double x)
Sets the value of a parameter.
|
void |
setFloat(int parameterIndex,
float x)
Sets the value of a parameter.
|
void |
setInt(int parameterIndex,
int x)
Sets the value of a parameter.
|
void |
setLong(int parameterIndex,
long x)
Sets the value of a parameter.
|
void |
setNull(int parameterIndex,
int sqlType)
Sets a parameter to null.
|
void |
setNull(int parameterIndex,
int sqlType,
String typeName)
Sets a parameter to null.
|
void |
setObject(int parameterIndex,
Object x)
Sets the value of a parameter.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType)
Sets the value of a parameter.
|
void |
setObject(int parameterIndex,
Object x,
int targetSqlType,
int scale)
Sets the value of a parameter.
|
void |
setRef(int parameterIndex,
Ref x)
[Not supported] Sets the value of a column as a reference.
|
void |
setShort(int parameterIndex,
short x)
Sets the value of a parameter.
|
void |
setString(int parameterIndex,
String x)
Sets the value of a parameter.
|
void |
setTime(int parameterIndex,
Time x)
Sets the value of a parameter.
|
void |
setTime(int parameterIndex,
Time x,
Calendar calendar)
Sets the time using a specified time zone.
|
void |
setTimestamp(int parameterIndex,
Timestamp x)
Sets the value of a parameter.
|
void |
setTimestamp(int parameterIndex,
Timestamp x,
Calendar calendar)
Sets the timestamp using a specified time zone.
|
void |
setUnicodeStream(int parameterIndex,
InputStream x,
int length)
Deprecated.
|
void |
setURL(int parameterIndex,
URL x)
[Not supported]
|
String |
toString()
INTERNAL
|
cancel, clearWarnings, closeOldResultSet, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getLastExecutedCommandType, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setExecutingStatement, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTrace, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setRowId, setSQLXML
cancel, clearWarnings, closeOnCompletion, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isCloseOnCompletion, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
isWrapperFor, unwrap
protected CommandInterface command
public ResultSet executeQuery() throws SQLException
executeQuery
in interface PreparedStatement
SQLException
- if this object is closed or invalidpublic int executeUpdate() throws SQLException
executeUpdate
in interface PreparedStatement
SQLException
- if this object is closed or invalidpublic boolean execute() throws SQLException
execute
in interface PreparedStatement
SQLException
- if this object is closed or invalidpublic void clearParameters() throws SQLException
clearParameters
in interface PreparedStatement
SQLException
- if this object is closed or invalidpublic ResultSet executeQuery(String sql) throws SQLException
executeQuery
in interface Statement
executeQuery
in class JdbcStatement
sql
- ignoredSQLException
- Unsupported Featurepublic void addBatch(String sql) throws SQLException
addBatch
in interface Statement
addBatch
in class JdbcStatement
sql
- ignoredSQLException
- Unsupported Featurepublic int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
executeUpdate
in class JdbcStatement
sql
- ignoredSQLException
- Unsupported Featurepublic boolean execute(String sql) throws SQLException
execute
in interface Statement
execute
in class JdbcStatement
sql
- ignoredSQLException
- Unsupported Featurepublic void setNull(int parameterIndex, int sqlType) throws SQLException
setNull
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)sqlType
- the data type (Types.x)SQLException
- if this object is closedpublic void setInt(int parameterIndex, int x) throws SQLException
setInt
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setString(int parameterIndex, String x) throws SQLException
setString
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
setBigDecimal
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setDate(int parameterIndex, Date x) throws SQLException
setDate
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setTime(int parameterIndex, Time x) throws SQLException
setTime
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
setTimestamp
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setObject(int parameterIndex, Object x) throws SQLException
setObject
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
setObject
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the type as defined in java.sql.TypesSQLException
- if this object is closedpublic void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
setObject
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the value, null is allowedtargetSqlType
- the type as defined in java.sql.Typesscale
- is ignoredSQLException
- if this object is closedpublic void setBoolean(int parameterIndex, boolean x) throws SQLException
setBoolean
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setByte(int parameterIndex, byte x) throws SQLException
setByte
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setShort(int parameterIndex, short x) throws SQLException
setShort
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setLong(int parameterIndex, long x) throws SQLException
setLong
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setFloat(int parameterIndex, float x) throws SQLException
setFloat
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setDouble(int parameterIndex, double x) throws SQLException
setDouble
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setRef(int parameterIndex, Ref x) throws SQLException
setRef
in interface PreparedStatement
SQLException
public void setDate(int parameterIndex, Date x, Calendar calendar) throws SQLException
setDate
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendarSQLException
- if this object is closedpublic void setTime(int parameterIndex, Time x, Calendar calendar) throws SQLException
setTime
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendarSQLException
- if this object is closedpublic void setTimestamp(int parameterIndex, Timestamp x, Calendar calendar) throws SQLException
setTimestamp
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuecalendar
- the calendarSQLException
- if this object is closedpublic void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
setUnicodeStream
in interface PreparedStatement
SQLException
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
setNull
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)sqlType
- the data type (Types.x)typeName
- this parameter is ignoredSQLException
- if this object is closedpublic void setBlob(int parameterIndex, Blob x) throws SQLException
setBlob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setBlob(int parameterIndex, InputStream x) throws SQLException
setBlob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setClob(int parameterIndex, Clob x) throws SQLException
setClob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setClob(int parameterIndex, Reader x) throws SQLException
setClob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setArray(int parameterIndex, Array x) throws SQLException
setArray
in interface PreparedStatement
SQLException
public void setBytes(int parameterIndex, byte[] x) throws SQLException
setBytes
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
setBinaryStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytesSQLException
- if this object is closedpublic void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
setBinaryStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytesSQLException
- if this object is closedpublic void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
setBinaryStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
setAsciiStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytesSQLException
- if this object is closedpublic void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
setAsciiStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytesSQLException
- if this object is closedpublic void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
setAsciiStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setCharacterStream(int parameterIndex, Reader x, int length) throws SQLException
setCharacterStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of charactersSQLException
- if this object is closedpublic void setCharacterStream(int parameterIndex, Reader x) throws SQLException
setCharacterStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valueSQLException
- if this object is closedpublic void setCharacterStream(int parameterIndex, Reader x, long length) throws SQLException
setCharacterStream
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of charactersSQLException
- if this object is closedpublic void setURL(int parameterIndex, URL x) throws SQLException
setURL
in interface PreparedStatement
SQLException
public ResultSetMetaData getMetaData() throws SQLException
getMetaData
in interface PreparedStatement
SQLException
- if this object is closedpublic void clearBatch() throws SQLException
clearBatch
in interface Statement
clearBatch
in class JdbcStatement
SQLException
public void close() throws SQLException
close
in interface AutoCloseable
close
in interface Statement
close
in class JdbcStatement
SQLException
public int[] executeBatch() throws SQLException
executeBatch
in interface Statement
executeBatch
in class JdbcStatement
SQLException
public void addBatch() throws SQLException
addBatch
in interface PreparedStatement
SQLException
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
executeUpdate
in class JdbcStatement
sql
- ignoredautoGeneratedKeys
- ignoredSQLException
- Unsupported Featurepublic int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate
in interface Statement
executeUpdate
in class JdbcStatement
sql
- ignoredcolumnIndexes
- ignoredSQLException
- Unsupported Featurepublic int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate
in interface Statement
executeUpdate
in class JdbcStatement
sql
- ignoredcolumnNames
- ignoredSQLException
- Unsupported Featurepublic boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute
in interface Statement
execute
in class JdbcStatement
sql
- ignoredautoGeneratedKeys
- ignoredSQLException
- Unsupported Featurepublic boolean execute(String sql, int[] columnIndexes) throws SQLException
execute
in interface Statement
execute
in class JdbcStatement
sql
- ignoredcolumnIndexes
- ignoredSQLException
- Unsupported Featurepublic boolean execute(String sql, String[] columnNames) throws SQLException
execute
in interface Statement
execute
in class JdbcStatement
sql
- ignoredcolumnNames
- ignoredSQLException
- Unsupported Featurepublic ParameterMetaData getParameterMetaData() throws SQLException
getParameterMetaData
in interface PreparedStatement
SQLException
public void setClob(int parameterIndex, Reader x, long length) throws SQLException
setClob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of charactersSQLException
- if this object is closedpublic void setBlob(int parameterIndex, InputStream x, long length) throws SQLException
setBlob
in interface PreparedStatement
parameterIndex
- the parameter index (1, 2, ...)x
- the valuelength
- the maximum number of bytesSQLException
- if this object is closedpublic String toString()
toString
in class JdbcStatement
protected boolean checkClosed(boolean write)
JdbcStatement
checkClosed
in class JdbcStatement
write
- if the next operation is possibly writingCopyright © 2012 JBoss by Red Hat. All Rights Reserved.