public class MariaDbCallableStatement extends Object implements CallableStatement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
Constructor and Description |
---|
MariaDbCallableStatement(MariaDbConnection connection,
String query)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addBatch()
Adds a set of parameters to this
PreparedStatement
object's batch of send. |
void |
addBatch(String sql)
Adds the given SQL command to the current list of send for this
Statement object. |
void |
cancel() |
void |
clearBatch()
Empties this
Statement object's current list of
SQL send. |
void |
clearParameters()
Clears the current parameter values immediately.
|
void |
clearWarnings() |
void |
close()
Releases this
Statement object's database
and JDBC resources immediately instead of waiting for
this to happen when it is automatically closed. |
void |
closeOnCompletion() |
boolean |
execute()
Executes the SQL statement in this
PreparedStatement object,
which may be any kind of SQL statement. |
boolean |
execute(String sql) |
boolean |
execute(String sql,
int autoGeneratedKeys) |
boolean |
execute(String sql,
int[] columnIndexes) |
boolean |
execute(String sql,
String[] columnNames) |
int[] |
executeBatch()
Submits a batch of send to the database for execution and
if all send execute successfully, returns an array of update counts.
|
ResultSet |
executeQuery()
Executes the SQL statement in this
PreparedStatement object,
which may be any kind of SQL statement. |
ResultSet |
executeQuery(String sql) |
int |
executeUpdate()
Retrieves the current result as an update count;
if the result is a
ResultSet object or there are no more results, -1
is returned. |
int |
executeUpdate(String sql) |
int |
executeUpdate(String sql,
int autoGeneratedKeys) |
int |
executeUpdate(String sql,
int[] columnIndexes) |
int |
executeUpdate(String sql,
String[] columnNames) |
Array |
getArray(int parameterIndex) |
Array |
getArray(String parameterName) |
BigDecimal |
getBigDecimal(int parameterIndex) |
BigDecimal |
getBigDecimal(int parameterIndex,
int scale)
Deprecated.
use
getBigDecimal(int parameterIndex)
or getBigDecimal(String parameterName) |
BigDecimal |
getBigDecimal(String parameterName) |
Blob |
getBlob(int parameterIndex) |
Blob |
getBlob(String parameterName) |
boolean |
getBoolean(int parameterIndex) |
boolean |
getBoolean(String parameterName) |
byte |
getByte(int parameterIndex) |
byte |
getByte(String parameterName) |
byte[] |
getBytes(int parameterIndex) |
byte[] |
getBytes(String parameterName) |
Reader |
getCharacterStream(int parameterIndex) |
Reader |
getCharacterStream(String parameterName) |
Clob |
getClob(int parameterIndex) |
Clob |
getClob(String parameterName) |
Connection |
getConnection() |
Date |
getDate(int parameterIndex) |
Date |
getDate(int parameterIndex,
Calendar cal) |
Date |
getDate(String parameterName) |
Date |
getDate(String parameterName,
Calendar cal) |
double |
getDouble(int parameterIndex) |
double |
getDouble(String parameterName) |
int |
getFetchDirection() |
int |
getFetchSize() |
float |
getFloat(int parameterIndex) |
float |
getFloat(String parameterName) |
ResultSet |
getGeneratedKeys() |
int |
getInt(int parameterIndex) |
int |
getInt(String parameterName) |
long |
getLong(int parameterIndex) |
long |
getLong(String parameterName) |
int |
getMaxFieldSize() |
int |
getMaxRows() |
ResultSetMetaData |
getMetaData()
Retrieves the number, types and properties of
this
ResultSet object's columns. |
boolean |
getMoreResults() |
boolean |
getMoreResults(int current) |
Reader |
getNCharacterStream(int parameterIndex) |
Reader |
getNCharacterStream(String parameterName) |
NClob |
getNClob(int parameterIndex) |
NClob |
getNClob(String parameterName) |
String |
getNString(int parameterIndex) |
String |
getNString(String parameterName) |
Object |
getObject(int parameterIndex)
Gets the value of the designated column in the current row
of this
ResultSet object as
an Object in the Java programming language. |
<T> T |
getObject(int arg0,
Class<T> arg1) |
Object |
getObject(int parameterIndex,
Map<String,Class<?>> map) |
Object |
getObject(String parameterName) |
<T> T |
getObject(String arg0,
Class<T> arg1) |
Object |
getObject(String parameterName,
Map<String,Class<?>> map) |
ParameterMetaData |
getParameterMetaData() |
int |
getQueryTimeout() |
Ref |
getRef(int parameterIndex) |
Ref |
getRef(String parameterName) |
ResultSet |
getResultSet() |
int |
getResultSetConcurrency() |
int |
getResultSetHoldability() |
int |
getResultSetType() |
RowId |
getRowId(int parameterIndex) |
RowId |
getRowId(String parameterName) |
short |
getShort(int parameterIndex) |
short |
getShort(String parameterName) |
SQLXML |
getSQLXML(int parameterIndex) |
SQLXML |
getSQLXML(String parameterName) |
String |
getString(int parameterIndex) |
String |
getString(String parameterName) |
Time |
getTime(int parameterIndex) |
Time |
getTime(int parameterIndex,
Calendar cal) |
Time |
getTime(String parameterName) |
Time |
getTime(String parameterName,
Calendar cal) |
Timestamp |
getTimestamp(int parameterIndex) |
Timestamp |
getTimestamp(int parameterIndex,
Calendar cal) |
Timestamp |
getTimestamp(String parameterName) |
Timestamp |
getTimestamp(String parameterName,
Calendar cal) |
int |
getUpdateCount() |
URL |
getURL(int parameterIndex) |
URL |
getURL(String parameterName) |
SQLWarning |
getWarnings() |
boolean |
isClosed() |
boolean |
isCloseOnCompletion() |
boolean |
isPoolable() |
boolean |
isWrapperFor(Class<?> iface) |
void |
registerOutParameter(int parameterIndex,
int sqlType) |
void |
registerOutParameter(int parameterIndex,
int sqlType,
int scale)
Registers the parameter in ordinal position
parameterIndex to be of JDBC type
sqlType . |
void |
registerOutParameter(int parameterIndex,
int sqlType,
String typeName)
Registers the designated output parameter.
|
void |
registerOutParameter(String parameterName,
int sqlType) |
void |
registerOutParameter(String parameterName,
int sqlType,
int scale) |
void |
registerOutParameter(String parameterName,
int sqlType,
String typeName) |
void |
setArray(int parameterIndex,
Array array) |
void |
setAsciiStream(int parameterIndex,
InputStream stream) |
void |
setAsciiStream(int parameterIndex,
InputStream stream,
int length) |
void |
setAsciiStream(int parameterIndex,
InputStream stream,
long length) |
void |
setAsciiStream(String parameterName,
InputStream stream) |
void |
setAsciiStream(String parameterName,
InputStream stream,
int length) |
void |
setAsciiStream(String parameterName,
InputStream stream,
long length) |
void |
setBigDecimal(int parameterIndex,
BigDecimal bigDecimal) |
void |
setBigDecimal(String parameterName,
BigDecimal bigDecimal) |
void |
setBinaryStream(int parameterIndex,
InputStream stream) |
void |
setBinaryStream(int parameterIndex,
InputStream stream,
int length) |
void |
setBinaryStream(int parameterIndex,
InputStream stream,
long length) |
void |
setBinaryStream(String parameterName,
InputStream stream) |
void |
setBinaryStream(String parameterName,
InputStream stream,
int length) |
void |
setBinaryStream(String parameterName,
InputStream stream,
long length) |
void |
setBlob(int parameterIndex,
Blob blob) |
void |
setBlob(int parameterIndex,
InputStream inputStream) |
void |
setBlob(int parameterIndex,
InputStream inputStream,
long length) |
void |
setBlob(String parameterName,
Blob blob) |
void |
setBlob(String parameterName,
InputStream inputStream) |
void |
setBlob(String parameterName,
InputStream inputStream,
long length) |
void |
setBoolean(int parameterIndex,
boolean bool) |
void |
setBoolean(String parameterName,
boolean bool) |
void |
setByte(int parameterIndex,
byte value) |
void |
setByte(String parameterName,
byte value) |
void |
setBytes(int parameterIndex,
byte[] bytes) |
void |
setBytes(String parameterName,
byte[] bytes) |
void |
setCharacterStream(int parameterIndex,
Reader reader) |
void |
setCharacterStream(int parameterIndex,
Reader reader,
int length) |
void |
setCharacterStream(int parameterIndex,
Reader reader,
long length) |
void |
setCharacterStream(String parameterName,
Reader reader) |
void |
setCharacterStream(String parameterName,
Reader reader,
int length) |
void |
setCharacterStream(String parameterName,
Reader reader,
long length) |
void |
setClob(int parameterIndex,
Clob clob) |
void |
setClob(int parameterIndex,
Reader reader) |
void |
setClob(int parameterIndex,
Reader reader,
long length) |
void |
setClob(String parameterName,
Clob clob) |
void |
setClob(String parameterName,
Reader reader) |
void |
setClob(String parameterName,
Reader reader,
long length) |
void |
setCursorName(String name) |
void |
setDate(int parameterIndex,
Date date) |
void |
setDate(int parameterIndex,
Date date,
Calendar cal) |
void |
setDate(String parameterName,
Date date) |
void |
setDate(String parameterName,
Date date,
Calendar cal) |
void |
setDouble(int parameterIndex,
double value) |
void |
setDouble(String parameterName,
double value) |
void |
setEscapeProcessing(boolean enable) |
void |
setFetchDirection(int direction) |
void |
setFetchSize(int rows) |
void |
setFloat(int parameterIndex,
float value) |
void |
setFloat(String parameterName,
float value) |
void |
setInt(int parameterIndex,
int value) |
void |
setInt(String parameterName,
int value) |
void |
setLong(int parameterIndex,
long value) |
void |
setLong(String parameterName,
long value) |
void |
setMaxFieldSize(int max) |
void |
setMaxRows(int max) |
void |
setNCharacterStream(int parameterIndex,
Reader value) |
void |
setNCharacterStream(int parameterIndex,
Reader value,
long length) |
void |
setNCharacterStream(String parameterName,
Reader value) |
void |
setNCharacterStream(String parameterName,
Reader value,
long length) |
void |
setNClob(int parameterIndex,
NClob value) |
void |
setNClob(int parameterIndex,
Reader reader) |
void |
setNClob(int parameterIndex,
Reader reader,
long length) |
void |
setNClob(String parameterName,
NClob value) |
void |
setNClob(String parameterName,
Reader reader) |
void |
setNClob(String parameterName,
Reader reader,
long length) |
void |
setNString(int parameterIndex,
String value) |
void |
setNString(String parameterName,
String value) |
void |
setNull(int parameterIndex,
int sqlType) |
void |
setNull(int parameterIndex,
int sqlType,
String typeName) |
void |
setNull(String parameterName,
int sqlType) |
void |
setNull(String parameterName,
int sqlType,
String typeName) |
void |
setObject(int parameterIndex,
Object obj) |
void |
setObject(int parameterIndex,
Object obj,
int targetSqlType) |
void |
setObject(int parameterIndex,
Object obj,
int targetSqlType,
int scaleOrLength) |
void |
setObject(String parameterName,
Object obj) |
void |
setObject(String parameterName,
Object obj,
int targetSqlType) |
void |
setObject(String parameterName,
Object obj,
int targetSqlType,
int scale) |
void |
setPoolable(boolean poolable) |
void |
setQueryTimeout(int seconds) |
void |
setRef(int parameterIndex,
Ref ref) |
void |
setRowId(int parameterIndex,
RowId rowid) |
void |
setRowId(String parameterName,
RowId rowid) |
void |
setShort(int parameterIndex,
short value) |
void |
setShort(String parameterName,
short value) |
void |
setSQLXML(int parameterIndex,
SQLXML xmlObject) |
void |
setSQLXML(String parameterName,
SQLXML xmlObject) |
void |
setString(int parameterIndex,
String str) |
void |
setString(String parameterName,
String str) |
void |
setTime(int parameterIndex,
Time time) |
void |
setTime(int parameterIndex,
Time time,
Calendar cal) |
void |
setTime(String parameterName,
Time time) |
void |
setTime(String parameterName,
Time time,
Calendar cal) |
void |
setTimestamp(int parameterIndex,
Timestamp timestamp) |
void |
setTimestamp(int parameterIndex,
Timestamp timestamp,
Calendar cal) |
void |
setTimestamp(String parameterName,
Timestamp timestamp) |
void |
setTimestamp(String parameterName,
Timestamp timestamp,
Calendar cal) |
void |
setUnicodeStream(int parameterIndex,
InputStream stream,
int length)
Deprecated.
Use
setCharacterStream |
void |
setURL(int parameterIndex,
URL url) |
void |
setURL(String parameterName,
URL val) |
<T> T |
unwrap(Class<T> iface) |
boolean |
wasNull() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, registerOutParameter, setObject, setObject
executeLargeUpdate, setObject, setObject
executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, getLargeMaxRows, getLargeUpdateCount, setLargeMaxRows
public MariaDbCallableStatement(MariaDbConnection connection, String query) throws SQLException
connection
- current connectionquery
- querySQLException
- exceptionpublic void registerOutParameter(int parameterIndex, int sqlType) throws SQLException
registerOutParameter
in interface CallableStatement
SQLException
public void registerOutParameter(int parameterIndex, int sqlType, int scale) throws SQLException
parameterIndex
to be of JDBC type
sqlType
. All OUT parameters must be registered
before a stored procedure is executed.
The JDBC type specified by sqlType
for an OUT
parameter determines the Java type that must be used
in the get
method to read the value of that parameter.
This version of registerOutParameter
should be
used when the parameter is of JDBC type NUMERIC
or DECIMAL
.
registerOutParameter
in interface CallableStatement
parameterIndex
- the first parameter is 1, the second is 2,
and so onsqlType
- the SQL type code defined by java.sql.Types
.scale
- the desired number of digits to the right of the
decimal point. It must be greater than or equal to zero.SQLException
- if the parameterIndex is not valid;
if a database access error occurs or
this method is called on a closed CallableStatement
SQLFeatureNotSupportedException
- if sqlType
is
a ARRAY
, BLOB
, CLOB
,
DATALINK
, JAVA_OBJECT
, NCHAR
,
NCLOB
, NVARCHAR
, LONGNVARCHAR
,
REF
, ROWID
, SQLXML
or STRUCT
data type and the JDBC driver does not support
this data typeTypes
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException
registerOutParameter
should be used for a user-defined or REF
output parameter. Examples
of user-defined types include: STRUCT
, DISTINCT
,
JAVA_OBJECT
, and named array types.
All OUT parameters must be registered before a stored procedure is executed.
For a user-defined parameter, the fully-qualified SQL
type name of the parameter should also be given, while a REF
parameter requires that the fully-qualified type name of the
referenced type be given. A JDBC driver that does not need the
type code and type name information may ignore it. To be portable,
however, applications should always provide these values for
user-defined and REF
parameters.
Although it is intended for user-defined and REF
parameters,
this method may be used to register a parameter of any JDBC type.
If the parameter does not have a user-defined or REF
type, the
typeName parameter is ignored.
Note: When reading the value of an out parameter, you must use the getter method whose Java type corresponds to the parameter's registered SQL type.
registerOutParameter
in interface CallableStatement
parameterIndex
- the first parameter is 1, the second is 2,...sqlType
- a value from Types
typeName
- the fully-qualified name of an SQL structured typeSQLException
- if the parameterIndex is not valid;
if a database access error occurs or
this method is called on a closed CallableStatement
SQLFeatureNotSupportedException
- if sqlType
is
a ARRAY
, BLOB
, CLOB
,
DATALINK
, JAVA_OBJECT
, NCHAR
,
NCLOB
, NVARCHAR
, LONGNVARCHAR
,
REF
, ROWID
, SQLXML
or STRUCT
data type and the JDBC driver does not support
this data typeTypes
public void registerOutParameter(String parameterName, int sqlType) throws SQLException
registerOutParameter
in interface CallableStatement
SQLException
public void registerOutParameter(String parameterName, int sqlType, int scale) throws SQLException
registerOutParameter
in interface CallableStatement
SQLException
public void registerOutParameter(String parameterName, int sqlType, String typeName) throws SQLException
registerOutParameter
in interface CallableStatement
SQLException
public boolean wasNull() throws SQLException
wasNull
in interface CallableStatement
SQLException
public String getString(int parameterIndex) throws SQLException
getString
in interface CallableStatement
SQLException
public String getString(String parameterName) throws SQLException
getString
in interface CallableStatement
SQLException
public boolean getBoolean(int parameterIndex) throws SQLException
getBoolean
in interface CallableStatement
SQLException
public boolean getBoolean(String parameterName) throws SQLException
getBoolean
in interface CallableStatement
SQLException
public byte getByte(int parameterIndex) throws SQLException
getByte
in interface CallableStatement
SQLException
public byte getByte(String parameterName) throws SQLException
getByte
in interface CallableStatement
SQLException
public short getShort(int parameterIndex) throws SQLException
getShort
in interface CallableStatement
SQLException
public short getShort(String parameterName) throws SQLException
getShort
in interface CallableStatement
SQLException
public int getInt(int parameterIndex) throws SQLException
getInt
in interface CallableStatement
SQLException
public int getInt(String parameterName) throws SQLException
getInt
in interface CallableStatement
SQLException
public long getLong(int parameterIndex) throws SQLException
getLong
in interface CallableStatement
SQLException
public long getLong(String parameterName) throws SQLException
getLong
in interface CallableStatement
SQLException
public float getFloat(int parameterIndex) throws SQLException
getFloat
in interface CallableStatement
SQLException
public float getFloat(String parameterName) throws SQLException
getFloat
in interface CallableStatement
SQLException
public double getDouble(int parameterIndex) throws SQLException
getDouble
in interface CallableStatement
SQLException
public double getDouble(String parameterName) throws SQLException
getDouble
in interface CallableStatement
SQLException
@Deprecated public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
getBigDecimal(int parameterIndex)
or getBigDecimal(String parameterName)
getBigDecimal
in interface CallableStatement
SQLException
public BigDecimal getBigDecimal(int parameterIndex) throws SQLException
getBigDecimal
in interface CallableStatement
SQLException
public BigDecimal getBigDecimal(String parameterName) throws SQLException
getBigDecimal
in interface CallableStatement
SQLException
public byte[] getBytes(int parameterIndex) throws SQLException
getBytes
in interface CallableStatement
SQLException
public byte[] getBytes(String parameterName) throws SQLException
getBytes
in interface CallableStatement
SQLException
public Date getDate(int parameterIndex) throws SQLException
getDate
in interface CallableStatement
SQLException
public Date getDate(int parameterIndex, Calendar cal) throws SQLException
getDate
in interface CallableStatement
SQLException
public Date getDate(String parameterName) throws SQLException
getDate
in interface CallableStatement
SQLException
public Date getDate(String parameterName, Calendar cal) throws SQLException
getDate
in interface CallableStatement
SQLException
public Time getTime(int parameterIndex) throws SQLException
getTime
in interface CallableStatement
SQLException
public Time getTime(int parameterIndex, Calendar cal) throws SQLException
getTime
in interface CallableStatement
SQLException
public Time getTime(String parameterName) throws SQLException
getTime
in interface CallableStatement
SQLException
public Time getTime(String parameterName, Calendar cal) throws SQLException
getTime
in interface CallableStatement
SQLException
public Timestamp getTimestamp(int parameterIndex) throws SQLException
getTimestamp
in interface CallableStatement
SQLException
public Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException
getTimestamp
in interface CallableStatement
SQLException
public Timestamp getTimestamp(String parameterName) throws SQLException
getTimestamp
in interface CallableStatement
SQLException
public Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException
getTimestamp
in interface CallableStatement
SQLException
public Object getObject(int parameterIndex) throws SQLException
Gets the value of the designated column in the current row
of this ResultSet
object as
an Object
in the Java programming language.
This method will return the value of the given column as a
Java object. The type of the Java object will be the default
Java object type corresponding to the column's SQL type,
following the mapping for built-in types specified in the JDBC
specification. If the value is an SQL NULL
,
the driver returns a Java null
.
This method may also be used to read database-specific
abstract data types.
In the JDBC 2.0 API, the behavior of method
getObject
is extended to materialize
data of SQL user-defined types.
If Connection.getTypeMap
does not throw a
SQLFeatureNotSupportedException
,
then when a column contains a structured or distinct value,
the behavior of this method is as
if it were a call to: getObject(columnIndex,
this.getStatement().getConnection().getTypeMap())
.
If Connection.getTypeMap
does throw a
SQLFeatureNotSupportedException
,
then structured values are not supported, and distinct values
are mapped to the default Java class as determined by the
underlying SQL type of the DISTINCT type.
getObject
in interface CallableStatement
parameterIndex
- the first column is 1, the second is 2, ...java.lang.Object
holding the column valueSQLException
- if the columnIndex is not valid;
if a database access error occurs or this method is
called on a closed result setpublic Object getObject(int parameterIndex, Map<String,Class<?>> map) throws SQLException
getObject
in interface CallableStatement
SQLException
public Object getObject(String parameterName) throws SQLException
getObject
in interface CallableStatement
SQLException
public Object getObject(String parameterName, Map<String,Class<?>> map) throws SQLException
getObject
in interface CallableStatement
SQLException
public <T> T getObject(int arg0, Class<T> arg1) throws SQLException
getObject
in interface CallableStatement
SQLException
public <T> T getObject(String arg0, Class<T> arg1) throws SQLException
getObject
in interface CallableStatement
SQLException
public Ref getRef(int parameterIndex) throws SQLException
getRef
in interface CallableStatement
SQLException
public Ref getRef(String parameterName) throws SQLException
getRef
in interface CallableStatement
SQLException
public Blob getBlob(int parameterIndex) throws SQLException
getBlob
in interface CallableStatement
SQLException
public Blob getBlob(String parameterName) throws SQLException
getBlob
in interface CallableStatement
SQLException
public Clob getClob(int parameterIndex) throws SQLException
getClob
in interface CallableStatement
SQLException
public Clob getClob(String parameterName) throws SQLException
getClob
in interface CallableStatement
SQLException
public Array getArray(int parameterIndex) throws SQLException
getArray
in interface CallableStatement
SQLException
public Array getArray(String parameterName) throws SQLException
getArray
in interface CallableStatement
SQLException
public URL getURL(int parameterIndex) throws SQLException
getURL
in interface CallableStatement
SQLException
public URL getURL(String parameterName) throws SQLException
getURL
in interface CallableStatement
SQLException
public void setURL(String parameterName, URL val) throws SQLException
setURL
in interface CallableStatement
SQLException
public void setURL(int parameterIndex, URL url) throws SQLException
setURL
in interface PreparedStatement
SQLException
public void setNull(String parameterName, int sqlType) throws SQLException
setNull
in interface CallableStatement
SQLException
public void setNull(int parameterIndex, int sqlType) throws SQLException
setNull
in interface PreparedStatement
SQLException
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
setNull
in interface PreparedStatement
SQLException
public void setNull(String parameterName, int sqlType, String typeName) throws SQLException
setNull
in interface CallableStatement
SQLException
public void setBoolean(int parameterIndex, boolean bool) throws SQLException
setBoolean
in interface PreparedStatement
SQLException
public void setBoolean(String parameterName, boolean bool) throws SQLException
setBoolean
in interface CallableStatement
SQLException
public void setByte(String parameterName, byte value) throws SQLException
setByte
in interface CallableStatement
SQLException
public void setByte(int parameterIndex, byte value) throws SQLException
setByte
in interface PreparedStatement
SQLException
public void setShort(String parameterName, short value) throws SQLException
setShort
in interface CallableStatement
SQLException
public void setShort(int parameterIndex, short value) throws SQLException
setShort
in interface PreparedStatement
SQLException
public void setInt(String parameterName, int value) throws SQLException
setInt
in interface CallableStatement
SQLException
public void setInt(int parameterIndex, int value) throws SQLException
setInt
in interface PreparedStatement
SQLException
public void setLong(String parameterName, long value) throws SQLException
setLong
in interface CallableStatement
SQLException
public void setLong(int parameterIndex, long value) throws SQLException
setLong
in interface PreparedStatement
SQLException
public void setFloat(String parameterName, float value) throws SQLException
setFloat
in interface CallableStatement
SQLException
public void setFloat(int parameterIndex, float value) throws SQLException
setFloat
in interface PreparedStatement
SQLException
public void setDouble(String parameterName, double value) throws SQLException
setDouble
in interface CallableStatement
SQLException
public void setDouble(int parameterIndex, double value) throws SQLException
setDouble
in interface PreparedStatement
SQLException
public void setBigDecimal(String parameterName, BigDecimal bigDecimal) throws SQLException
setBigDecimal
in interface CallableStatement
SQLException
public void setBigDecimal(int parameterIndex, BigDecimal bigDecimal) throws SQLException
setBigDecimal
in interface PreparedStatement
SQLException
public void setString(String parameterName, String str) throws SQLException
setString
in interface CallableStatement
SQLException
public void setString(int parameterIndex, String str) throws SQLException
setString
in interface PreparedStatement
SQLException
public void setBytes(String parameterName, byte[] bytes) throws SQLException
setBytes
in interface CallableStatement
SQLException
public void setBytes(int parameterIndex, byte[] bytes) throws SQLException
setBytes
in interface PreparedStatement
SQLException
public void setDate(String parameterName, Date date, Calendar cal) throws SQLException
setDate
in interface CallableStatement
SQLException
public void setDate(int parameterIndex, Date date) throws SQLException
setDate
in interface PreparedStatement
SQLException
public void setDate(int parameterIndex, Date date, Calendar cal) throws SQLException
setDate
in interface PreparedStatement
SQLException
public void setDate(String parameterName, Date date) throws SQLException
setDate
in interface CallableStatement
SQLException
public void setTime(String parameterName, Time time, Calendar cal) throws SQLException
setTime
in interface CallableStatement
SQLException
public void setTime(int parameterIndex, Time time) throws SQLException
setTime
in interface PreparedStatement
SQLException
public void setTime(int parameterIndex, Time time, Calendar cal) throws SQLException
setTime
in interface PreparedStatement
SQLException
public void setTime(String parameterName, Time time) throws SQLException
setTime
in interface CallableStatement
SQLException
public void setTimestamp(String parameterName, Timestamp timestamp) throws SQLException
setTimestamp
in interface CallableStatement
SQLException
public void setTimestamp(String parameterName, Timestamp timestamp, Calendar cal) throws SQLException
setTimestamp
in interface CallableStatement
SQLException
public void setTimestamp(int parameterIndex, Timestamp timestamp) throws SQLException
setTimestamp
in interface PreparedStatement
SQLException
public void setTimestamp(int parameterIndex, Timestamp timestamp, Calendar cal) throws SQLException
setTimestamp
in interface PreparedStatement
SQLException
public void setAsciiStream(String parameterName, InputStream stream, int length) throws SQLException
setAsciiStream
in interface CallableStatement
SQLException
public void setAsciiStream(String parameterName, InputStream stream, long length) throws SQLException
setAsciiStream
in interface CallableStatement
SQLException
public void setAsciiStream(String parameterName, InputStream stream) throws SQLException
setAsciiStream
in interface CallableStatement
SQLException
public void setAsciiStream(int parameterIndex, InputStream stream, int length) throws SQLException
setAsciiStream
in interface PreparedStatement
SQLException
public void setAsciiStream(int parameterIndex, InputStream stream, long length) throws SQLException
setAsciiStream
in interface PreparedStatement
SQLException
public void setAsciiStream(int parameterIndex, InputStream stream) throws SQLException
setAsciiStream
in interface PreparedStatement
SQLException
public void setBinaryStream(String parameterName, InputStream stream, int length) throws SQLException
setBinaryStream
in interface CallableStatement
SQLException
public void setBinaryStream(String parameterName, InputStream stream, long length) throws SQLException
setBinaryStream
in interface CallableStatement
SQLException
public void setBinaryStream(String parameterName, InputStream stream) throws SQLException
setBinaryStream
in interface CallableStatement
SQLException
public void setBinaryStream(int parameterIndex, InputStream stream, int length) throws SQLException
setBinaryStream
in interface PreparedStatement
SQLException
public void setBinaryStream(int parameterIndex, InputStream stream, long length) throws SQLException
setBinaryStream
in interface PreparedStatement
SQLException
public void setBinaryStream(int parameterIndex, InputStream stream) throws SQLException
setBinaryStream
in interface PreparedStatement
SQLException
public void setObject(String parameterName, Object obj, int targetSqlType, int scale) throws SQLException
setObject
in interface CallableStatement
SQLException
public void setObject(String parameterName, Object obj, int targetSqlType) throws SQLException
setObject
in interface CallableStatement
SQLException
public void setObject(String parameterName, Object obj) throws SQLException
setObject
in interface CallableStatement
SQLException
public void setObject(int parameterIndex, Object obj, int targetSqlType) throws SQLException
setObject
in interface PreparedStatement
SQLException
public void setObject(int parameterIndex, Object obj) throws SQLException
setObject
in interface PreparedStatement
SQLException
public void setObject(int parameterIndex, Object obj, int targetSqlType, int scaleOrLength) throws SQLException
setObject
in interface PreparedStatement
SQLException
public void setCharacterStream(String parameterName, Reader reader, int length) throws SQLException
setCharacterStream
in interface CallableStatement
SQLException
public void setCharacterStream(String parameterName, Reader reader, long length) throws SQLException
setCharacterStream
in interface CallableStatement
SQLException
public void setCharacterStream(String parameterName, Reader reader) throws SQLException
setCharacterStream
in interface CallableStatement
SQLException
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
setCharacterStream
in interface PreparedStatement
SQLException
public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
setCharacterStream
in interface PreparedStatement
SQLException
public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
setCharacterStream
in interface PreparedStatement
SQLException
public RowId getRowId(int parameterIndex) throws SQLException
getRowId
in interface CallableStatement
SQLException
public RowId getRowId(String parameterName) throws SQLException
getRowId
in interface CallableStatement
SQLException
public void setRowId(String parameterName, RowId rowid) throws SQLException
setRowId
in interface CallableStatement
SQLException
public void setRowId(int parameterIndex, RowId rowid) throws SQLException
setRowId
in interface PreparedStatement
SQLException
public void setNString(String parameterName, String value) throws SQLException
setNString
in interface CallableStatement
SQLException
public void setNString(int parameterIndex, String value) throws SQLException
setNString
in interface PreparedStatement
SQLException
public void setNCharacterStream(String parameterName, Reader value, long length) throws SQLException
setNCharacterStream
in interface CallableStatement
SQLException
public void setNCharacterStream(String parameterName, Reader value) throws SQLException
setNCharacterStream
in interface CallableStatement
SQLException
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
setNCharacterStream
in interface PreparedStatement
SQLException
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
setNCharacterStream
in interface PreparedStatement
SQLException
public void setNClob(String parameterName, NClob value) throws SQLException
setNClob
in interface CallableStatement
SQLException
public void setNClob(String parameterName, Reader reader, long length) throws SQLException
setNClob
in interface CallableStatement
SQLException
public void setNClob(String parameterName, Reader reader) throws SQLException
setNClob
in interface CallableStatement
SQLException
public void setNClob(int parameterIndex, NClob value) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public void setNClob(int parameterIndex, Reader reader) throws SQLException
setNClob
in interface PreparedStatement
SQLException
public void setClob(int parameterIndex, Clob clob) throws SQLException
setClob
in interface PreparedStatement
SQLException
public void setClob(String parameterName, Reader reader, long length) throws SQLException
setClob
in interface CallableStatement
SQLException
public void setClob(String parameterName, Clob clob) throws SQLException
setClob
in interface CallableStatement
SQLException
public void setClob(String parameterName, Reader reader) throws SQLException
setClob
in interface CallableStatement
SQLException
public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
setClob
in interface PreparedStatement
SQLException
public void setClob(int parameterIndex, Reader reader) throws SQLException
setClob
in interface PreparedStatement
SQLException
public void setBlob(String parameterName, InputStream inputStream, long length) throws SQLException
setBlob
in interface CallableStatement
SQLException
public void setBlob(String parameterName, Blob blob) throws SQLException
setBlob
in interface CallableStatement
SQLException
public void setBlob(int parameterIndex, Blob blob) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
setBlob
in interface PreparedStatement
SQLException
public void setBlob(String parameterName, InputStream inputStream) throws SQLException
setBlob
in interface CallableStatement
SQLException
public NClob getNClob(int parameterIndex) throws SQLException
getNClob
in interface CallableStatement
SQLException
public NClob getNClob(String parameterName) throws SQLException
getNClob
in interface CallableStatement
SQLException
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException
setSQLXML
in interface CallableStatement
SQLException
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
setSQLXML
in interface PreparedStatement
SQLException
public SQLXML getSQLXML(int parameterIndex) throws SQLException
getSQLXML
in interface CallableStatement
SQLException
public SQLXML getSQLXML(String parameterName) throws SQLException
getSQLXML
in interface CallableStatement
SQLException
public String getNString(int parameterIndex) throws SQLException
getNString
in interface CallableStatement
SQLException
public String getNString(String parameterName) throws SQLException
getNString
in interface CallableStatement
SQLException
public Reader getNCharacterStream(int parameterIndex) throws SQLException
getNCharacterStream
in interface CallableStatement
SQLException
public Reader getNCharacterStream(String parameterName) throws SQLException
getNCharacterStream
in interface CallableStatement
SQLException
public Reader getCharacterStream(int parameterIndex) throws SQLException
getCharacterStream
in interface CallableStatement
SQLException
public Reader getCharacterStream(String parameterName) throws SQLException
getCharacterStream
in interface CallableStatement
SQLException
public ResultSet executeQuery() throws SQLException
PreparedStatement
object,
which may be any kind of SQL statement.
Some prepared statements return multiple results; the execute
method handles these complex statements as well as the simpler
form of statements handled by the methods executeQuery
and executeUpdate
.
The execute
method returns a boolean
to
indicate the form of the first result. You must call either the method
getResultSet
or getUpdateCount
to retrieve the result; you must call getInternalMoreResults
to
move to any subsequent result(s).
executeQuery
in interface PreparedStatement
true
if the first result is a ResultSet
object; false
if the first result is an update
count or there is no resultSQLException
- if a database access error occurs;
this method is called on a closed PreparedStatement
or an argument is supplied to this methodSQLTimeoutException
- when the driver has determined that the
timeout value that was specified by the setQueryTimeout
method has been exceeded and has at least attempted to cancel
the currently running Statement
Statement.execute(java.lang.String)
,
Statement.getResultSet()
,
Statement.getUpdateCount()
,
Statement.getMoreResults()
public ResultSet executeQuery(String sql) throws SQLException
executeQuery
in interface Statement
SQLException
public int executeUpdate() throws SQLException
ResultSet
object or there are no more results, -1
is returned. This method should be called only once per result.executeUpdate
in interface PreparedStatement
ResultSet
object or there are no more resultsSQLException
- if a database access error occurs or
this method is called on a closed Statement
execute()
public int executeUpdate(String sql) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
executeUpdate
in interface Statement
SQLException
public int executeUpdate(String sql, String[] columnNames) throws SQLException
executeUpdate
in interface Statement
SQLException
@Deprecated public void setUnicodeStream(int parameterIndex, InputStream stream, int length) throws SQLException
setCharacterStream
setUnicodeStream
in interface PreparedStatement
SQLException
public void clearParameters() throws SQLException
In general, parameter values remain in force for repeated use
of a statement. Setting a parameter value automatically clears its previous value. However, in some cases it is
useful to immediately release the resources used by the current parameter values; this can be done by calling the
method clearParameters
.
clearParameters
in interface PreparedStatement
SQLException
public SQLWarning getWarnings() throws SQLException
getWarnings
in interface Statement
SQLException
public boolean execute() throws SQLException
PreparedStatement
object,
which may be any kind of SQL statement.
Some prepared statements return multiple results; the execute
method handles these complex statements as well as the simpler
form of statements handled by the methods executeQuery
and executeUpdate
.
The execute
method returns a boolean
to
indicate the form of the first result. You must call either the method
getResultSet
or getUpdateCount
to retrieve the result; you must call getInternalMoreResults
to
move to any subsequent result(s).
execute
in interface PreparedStatement
true
if the first result is a ResultSet
object; false
if the first result is an update
count or there is no resultSQLException
- if a database access error occurs;
this method is called on a closed PreparedStatement
or an argument is supplied to this methodSQLTimeoutException
- when the driver has determined that the
timeout value that was specified by the setQueryTimeout
method has been exceeded and has at least attempted to cancel
the currently running Statement
Statement.execute(java.lang.String)
,
Statement.getResultSet()
,
Statement.getUpdateCount()
,
Statement.getMoreResults()
public boolean execute(String sql) throws SQLException
execute
in interface Statement
SQLException
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
execute
in interface Statement
SQLException
public boolean execute(String sql, int[] columnIndexes) throws SQLException
execute
in interface Statement
SQLException
public boolean execute(String sql, String[] columnNames) throws SQLException
execute
in interface Statement
SQLException
public void addBatch() throws SQLException
PreparedStatement
object's batch of send.addBatch
in interface PreparedStatement
SQLException
- if a database access error occurs or
this method is called on a closed PreparedStatement
Statement.addBatch(java.lang.String)
public void addBatch(String sql) throws SQLException
Statement
object. The send in this list can be
executed as a batch by calling the method executeBatch
.
Note:This method cannot be called on a
PreparedStatement
or CallableStatement
.
addBatch
in interface Statement
sql
- typically this is a SQL INSERT
or
UPDATE
statementSQLException
- if a database access error occurs,
this method is called on a closed Statement
, the
driver does not support batch updates, the method is called on a
PreparedStatement
or CallableStatement
executeBatch()
,
DatabaseMetaData.supportsBatchUpdates()
public void setRef(int parameterIndex, Ref ref) throws SQLException
setRef
in interface PreparedStatement
SQLException
public void setArray(int parameterIndex, Array array) throws SQLException
setArray
in interface PreparedStatement
SQLException
public ParameterMetaData getParameterMetaData() throws SQLException
getParameterMetaData
in interface PreparedStatement
SQLException
public ResultSetMetaData getMetaData() throws SQLException
ResultSet
object's columns.getMetaData
in interface PreparedStatement
ResultSet
object's columnsSQLException
- if a database access error occurs or this method is
called on a closed result setpublic void close() throws SQLException
Statement
object's database
and JDBC resources immediately instead of waiting for
this to happen when it is automatically closed.
It is generally good practice to release resources as soon as
you are finished with them to avoid tying up database
resources.
Calling the method close
on a Statement
object that is already closed has no effect.
Note:When a Statement
object is
closed, its current ResultSet
object, if one exists, is
also closed.
close
in interface AutoCloseable
close
in interface Statement
SQLException
- if a database access error occurspublic int getMaxFieldSize() throws SQLException
getMaxFieldSize
in interface Statement
SQLException
public void setMaxFieldSize(int max) throws SQLException
setMaxFieldSize
in interface Statement
SQLException
public int getMaxRows() throws SQLException
getMaxRows
in interface Statement
SQLException
public void setMaxRows(int max) throws SQLException
setMaxRows
in interface Statement
SQLException
public void setEscapeProcessing(boolean enable) throws SQLException
setEscapeProcessing
in interface Statement
SQLException
public int getQueryTimeout() throws SQLException
getQueryTimeout
in interface Statement
SQLException
public void setQueryTimeout(int seconds) throws SQLException
setQueryTimeout
in interface Statement
SQLException
public void cancel() throws SQLException
cancel
in interface Statement
SQLException
public void clearWarnings() throws SQLException
clearWarnings
in interface Statement
SQLException
public void setCursorName(String name) throws SQLException
setCursorName
in interface Statement
SQLException
public ResultSet getResultSet() throws SQLException
getResultSet
in interface Statement
SQLException
public int getUpdateCount() throws SQLException
getUpdateCount
in interface Statement
SQLException
public boolean getMoreResults() throws SQLException
getMoreResults
in interface Statement
SQLException
public boolean getMoreResults(int current) throws SQLException
getMoreResults
in interface Statement
SQLException
public int getFetchDirection() throws SQLException
getFetchDirection
in interface Statement
SQLException
public void setFetchDirection(int direction) throws SQLException
setFetchDirection
in interface Statement
SQLException
public int getFetchSize() throws SQLException
getFetchSize
in interface Statement
SQLException
public void setFetchSize(int rows) throws SQLException
setFetchSize
in interface Statement
SQLException
public int getResultSetConcurrency() throws SQLException
getResultSetConcurrency
in interface Statement
SQLException
public int getResultSetType() throws SQLException
getResultSetType
in interface Statement
SQLException
public void clearBatch() throws SQLException
Statement
object's current list of
SQL send.clearBatch
in interface Statement
SQLException
- if a database access error occurs,
this method is called on a closed Statement
or the
driver does not support batch updatesaddBatch()
,
DatabaseMetaData.supportsBatchUpdates()
public int[] executeBatch() throws SQLException
int
elements of the array that is returned are ordered
to correspond to the send in the batch, which are ordered
according to the order in which they were added to the batch.
The elements in the array returned by the method executeBatch
may be one of the following:
SUCCESS_NO_INFO
-- indicates that the command was
processed successfully but that the number of rows affected is
unknown
If one of the send in a batch update fails to execute properly,
this method throws a BatchUpdateException
, and a JDBC
driver may or may not continue to process the remaining send in
the batch. However, the driver's behavior must be consistent with a
particular DBMS, either always continuing to process send or never
continuing to process send. If the driver continues processing
after a failure, the array returned by the method
BatchUpdateException.getUpdateCounts
will contain as many elements as there are send in the batch, and
at least one of the elements will be the following:
EXECUTE_FAILED
-- indicates that the command failed
to execute successfully and occurs only if a driver continues to
process send after a command fails
The possible implementations and return values have been modified in
the Java 2 SDK, Standard Edition, version 1.3 to
accommodate the option of continuing to process send in a batch
update after a BatchUpdateException
object has been thrown.
executeBatch
in interface Statement
SQLException
- if a database access error occurs,
this method is called on a closed Statement
or the
driver does not support batch statements. Throws BatchUpdateException
(a subclass of SQLException
) if one of the send sent to the
database fails to execute properly or attempts to return a result set.SQLTimeoutException
- when the driver has determined that the
timeout value that was specified by the setQueryTimeout
method has been exceeded and has at least attempted to cancel
the currently running Statement
addBatch()
,
DatabaseMetaData.supportsBatchUpdates()
public Connection getConnection() throws SQLException
getConnection
in interface Statement
SQLException
public ResultSet getGeneratedKeys() throws SQLException
getGeneratedKeys
in interface Statement
SQLException
public int getResultSetHoldability() throws SQLException
getResultSetHoldability
in interface Statement
SQLException
public boolean isClosed() throws SQLException
isClosed
in interface Statement
SQLException
public boolean isPoolable() throws SQLException
isPoolable
in interface Statement
SQLException
public void setPoolable(boolean poolable) throws SQLException
setPoolable
in interface Statement
SQLException
public <T> T unwrap(Class<T> iface) throws SQLException
unwrap
in interface Wrapper
SQLException
public boolean isWrapperFor(Class<?> iface) throws SQLException
isWrapperFor
in interface Wrapper
SQLException
public void closeOnCompletion() throws SQLException
closeOnCompletion
in interface Statement
SQLException
public boolean isCloseOnCompletion() throws SQLException
isCloseOnCompletion
in interface Statement
SQLException
Copyright © 2016. All rights reserved.