|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.impl.jdbc.ConnectionChild
org.apache.derby.impl.jdbc.EmbedStatement
org.apache.derby.impl.jdbc.EmbedPreparedStatement
public abstract class EmbedPreparedStatement
EmbedPreparedStatement is a local JDBC statement.
Supports
Field Summary | |
---|---|
private Activation |
activation
|
private BrokeredConnectionControl |
bcc
|
private java.lang.String |
gcDuringGetMetaData
|
protected PreparedStatement |
preparedStatement
|
protected java.sql.ResultSetMetaData |
rMetaData
|
private java.lang.Boolean |
usePreTenFiveHdrFormat
Tells which header format to use when writing CLOBs into the store. |
Fields inherited from class org.apache.derby.impl.jdbc.EmbedStatement |
---|
applicationStatement, batchStatements, isPoolable, lcc, MaxFieldSize, maxRows, results, resultSetConcurrency, resultSetType, SQLText, timeoutMillis, updateCount |
Fields inherited from class org.apache.derby.impl.jdbc.ConnectionChild |
---|
factory, localConn |
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 |
Constructor Summary | |
---|---|
EmbedPreparedStatement(EmbedConnection conn,
java.lang.String sql,
boolean forMetaData,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability,
int autoGeneratedKeys,
int[] columnIndexes,
java.lang.String[] columnNames)
Constructor assumes caller will setup context stack and restore it. |
Method Summary | |
---|---|
void |
addBatch()
JDBC 2.0 Add a set of parameters to the batch. |
void |
addBatch(java.lang.String sql)
JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. |
private void |
checkAsciiStreamConditions(int parameterIndex)
Check general preconditions for setAsciiStream methods. |
private void |
checkBinaryStreamConditions(int parameterIndex)
Check general preconditions for setBinaryStream methods. |
private void |
checkBlobConditions(int parameterIndex)
Check general (pre)conditions for setBlob methods. |
private void |
checkCharacterStreamConditions(int parameterIndex)
Check general preconditions for setCharacterStream methods. |
private void |
checkClobConditions(int parameterIndex)
Check general (pre)conditions for setClob methods. |
private void |
checkForSupportedDataType(int dataType)
Checks whether a data type is supported for setObject(int, Object, int) and
setObject(int, Object, int, int) . |
private void |
checkStatementValidity(java.sql.SQLException sqle)
Method calls onStatementError occurred on the BrokeredConnectionControl class after checking the SQLState of the SQLException thrown. |
void |
clearParameters()
In general, parameter values remain in force for repeated use of a Statement. |
(package private) void |
closeActions()
Additional close to close our activation. |
(package private) java.sql.SQLException |
dataTypeConversion(int column,
java.lang.String sourceType)
|
boolean |
execute()
|
boolean |
execute(java.lang.String sql)
Execute a SQL statement that may return multiple results. |
boolean |
execute(java.lang.String sql,
int autoGenKeys)
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. |
boolean |
execute(java.lang.String sql,
int[] columnIndexes)
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. |
boolean |
execute(java.lang.String sql,
java.lang.String[] columnNames)
JDBC 3.0 Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. |
(package private) boolean |
executeBatchElement(java.lang.Object batchElement)
Execute a single element of the batch. |
java.sql.ResultSet |
executeQuery()
A prepared SQL query is executed and its ResultSet is returned. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Execute a SQL statement that returns a single ResultSet. |
(package private) boolean |
executeStatement(Activation a,
boolean executeQuery,
boolean executeUpdate)
Execute the current statement. |
int |
executeUpdate()
Execute a SQL INSERT, UPDATE or DELETE statement. |
int |
executeUpdate(java.lang.String sql)
Execute a SQL INSERT, UPDATE or DELETE statement. |
int |
executeUpdate(java.lang.String sql,
int autoGenKeys)
JDBC 3.0 Execute the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval. |
int |
executeUpdate(java.lang.String sql,
int[] columnIndexes)
JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. |
int |
executeUpdate(java.lang.String sql,
java.lang.String[] columnNames)
JDBC 3.0 Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. |
protected void |
finalize()
JDBC states that a Statement is closed when garbage collected. |
private EngineParameterMetaData |
getEmbedParameterSetMetaData()
Immitate the function in JDBC 3.0 Retrieves the number, types and properties of this PreparedStatement object's parameters. |
java.sql.ResultSetMetaData |
getMetaData()
JDBC 2.0 The number, types and properties of a ResultSet's columns are provided by the getMetaData method. |
protected int |
getParameterJDBCType(int parameterIndex)
Get the target JDBC type for a parameter. |
protected java.lang.String |
getParameterSQLType(int parameterIndex)
Return the SQL type name for the parameter. |
ParameterValueSet |
getParms()
Get the ParameterValueSet from the activation. |
protected DataTypeDescriptor[] |
getTypes(int parameterIndex)
Check the parameterINdex is in range and return the array of type descriptors. |
protected EmbedResultSetMetaData |
newEmbedResultSetMetaData(ResultDescription resultDesc)
|
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x)
Sets the designated parameter to the given input stream. |
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
int length)
We do this inefficiently and read it all in here. |
void |
setAsciiStream(int parameterIndex,
java.io.InputStream x,
long length)
We do this inefficiently and read it all in here. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x)
Sets the designated parameter to the given input stream. |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
int length)
sets the parameter to the binary stream |
void |
setBinaryStream(int parameterIndex,
java.io.InputStream x,
long length)
sets the parameter to the Binary stream |
private void |
setBinaryStreamInternal(int parameterIndex,
java.io.InputStream x,
boolean lengthLess,
long length)
Set the given stream for the specified parameter. |
void |
setBlob(int i,
java.sql.Blob x)
JDBC 2.0 Set a BLOB parameter. |
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream)
Sets the designated parameter to a InputStream object. |
void |
setBlob(int parameterIndex,
java.io.InputStream inputStream,
long length)
Sets the designated parameter to a InputStream object. |
void |
setBoolean(int parameterIndex,
boolean x)
Set a parameter to a Java boolean value. |
void |
setBrokeredConnectionControl(BrokeredConnectionControl control)
This method is used to initialize the BrokeredConnectionControl variable with its implementation. |
void |
setByte(int parameterIndex,
byte x)
Set a parameter to a Java byte value. |
void |
setBytes(int parameterIndex,
byte[] x)
Set a parameter to a Java array of bytes. |
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader)
Sets the designated parameter to the given Reader object. |
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
int length)
When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. |
void |
setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length)
When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.Reader. |
private void |
setCharacterStreamInternal(int parameterIndex,
java.io.Reader reader,
boolean lengthLess,
long length)
Set the given character stream for the specified parameter. |
void |
setClob(int i,
java.sql.Clob x)
JDBC 2.0 Set a CLOB parameter. |
void |
setClob(int parameterIndex,
java.io.Reader reader)
Sets the designated parameter to a Reader object. |
void |
setClob(int parameterIndex,
java.io.Reader reader,
long length)
Sets the designated parameter to a Reader object. |
void |
setDate(int parameterIndex,
java.sql.Date x)
Set a parameter to a java.sql.Date value. |
void |
setDate(int parameterIndex,
java.sql.Date x,
java.util.Calendar cal)
Set a parameter to a java.sql.Date value. |
void |
setDouble(int parameterIndex,
double x)
Set a parameter to a Java double value. |
void |
setFloat(int parameterIndex,
float x)
Set a parameter to a Java float value. |
void |
setInt(int parameterIndex,
int x)
Set a parameter to a Java int value. |
void |
setLong(int parameterIndex,
long x)
Set a parameter to a Java long value. |
void |
setNull(int parameterIndex,
int sqlType)
Set a parameter to SQL NULL. |
void |
setNull(int paramIndex,
int sqlType,
java.lang.String typeName)
JDBC 2.0 Sets the designated parameter to SQL NULL . |
void |
setObject(int parameterIndex,
java.lang.Object x)
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType)
This method is like setObject above, but assumes a scale of zero. |
void |
setObject(int parameterIndex,
java.lang.Object x,
int targetSqlType,
int scale)
The interface says that the type of the Object parameter must be compatible with the type of the targetSqlType. |
(package private) boolean |
setObjectConvert(int parameterIndex,
java.lang.Object x)
Allow explict setObject conversions by sub-classes for classes not supported by this variant. |
private void |
setScale(int parameterIndex,
int scale)
Set the scale of a parameter. |
void |
setShort(int parameterIndex,
short x)
Set a parameter to a Java short value. |
void |
setString(int parameterIndex,
java.lang.String x)
Set a parameter to a Java String value. |
void |
setTime(int parameterIndex,
java.sql.Time x)
Set a parameter to a java.sql.Time value. |
void |
setTime(int parameterIndex,
java.sql.Time x,
java.util.Calendar cal)
Set a parameter to a java.sql.Time value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x)
Set a parameter to a java.sql.Timestamp value. |
void |
setTimestamp(int parameterIndex,
java.sql.Timestamp x,
java.util.Calendar cal)
Set a parameter to a java.sql.Timestamp value. |
void |
setUnicodeStream(int parameterIndex,
java.io.InputStream x,
int length)
Deprecated. |
void |
setURL(int parameterIndex,
java.net.URL x)
JDBC 3.0 Sets the designated parameter to the given java.net.URL value. |
java.lang.String |
toString()
|
void |
transferParameters(EmbedPreparedStatement newStatement)
|
private java.lang.Boolean |
usePreTenFiveHdrFormat()
Determines which header format to use for CLOBs when writing them to the store. |
Methods inherited from class org.apache.derby.impl.jdbc.ConnectionChild |
---|
commitIfAutoCommit, commitIfNeeded, getCal, getConnectionSynchronization, getEmbedConnection, handleException, needCommit, newSQLException, newSQLException, newSQLException, restoreContextStack, setupContextStack |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.sql.PreparedStatement |
---|
getParameterMetaData, setArray, setBigDecimal, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNString, setRef, setRowId, setSQLXML |
Methods inherited from interface java.sql.Statement |
---|
cancel, clearBatch, clearWarnings, close, executeBatch, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout |
Methods inherited from interface java.sql.Wrapper |
---|
isWrapperFor, unwrap |
Field Detail |
---|
protected java.sql.ResultSetMetaData rMetaData
private java.lang.String gcDuringGetMetaData
protected PreparedStatement preparedStatement
private Activation activation
private java.lang.Boolean usePreTenFiveHdrFormat
This is lazily set if we need it, and there are currently only two valid header formats to choose between.
usePreTenFiveHdrFormat()
private BrokeredConnectionControl bcc
Constructor Detail |
---|
public EmbedPreparedStatement(EmbedConnection conn, java.lang.String sql, boolean forMetaData, int resultSetType, int resultSetConcurrency, int resultSetHoldability, int autoGeneratedKeys, int[] columnIndexes, java.lang.String[] columnNames) throws java.sql.SQLException
java.sql.SQLException
Method Detail |
---|
protected void finalize() throws java.lang.Throwable
finalize
in class EmbedStatement
java.lang.Throwable
- Allows any exception to be thrown during finalizepublic final boolean execute(java.lang.String sql) throws java.sql.SQLException
EmbedStatement
execute
in interface java.sql.Statement
execute
in class EmbedStatement
sql
- any SQL statement
java.sql.SQLException
- thrown on failureEmbedStatement.getResultSet()
,
EmbedStatement.getUpdateCount()
,
EmbedStatement.getMoreResults()
public final boolean execute(java.lang.String sql, int autoGenKeys) throws java.sql.SQLException
EmbedStatement
execute
in interface java.sql.Statement
execute
in class EmbedStatement
sql
- any SQL statementautoGenKeys
- - a constant indicating whether
auto-generated keys should be made available for retrieval using
the method getGeneratedKeys; one of the following constants:
Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS
java.sql.SQLException
- if a database access error occurspublic final boolean execute(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
EmbedStatement
execute
in interface java.sql.Statement
execute
in class EmbedStatement
sql
- any SQL statementcolumnIndexes
- - an array of the indexes of the columns in the
inserted row that should be made available for retrieval by a call to
the method getGeneratedKeys
java.sql.SQLException
- if a database access error occurspublic final boolean execute(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
EmbedStatement
execute
in interface java.sql.Statement
execute
in class EmbedStatement
sql
- any SQL statementcolumnNames
- - an array of the names of the columns in the
inserted row that should be made available for retrieval by a call to
the method getGeneratedKeys
java.sql.SQLException
- if a database access error occurspublic final java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
EmbedStatement
executeQuery
in interface java.sql.Statement
executeQuery
in class EmbedStatement
sql
- typically this is a static SQL SELECT statement
java.sql.SQLException
- thrown on failure.public final int executeUpdate(java.lang.String sql) throws java.sql.SQLException
EmbedStatement
executeUpdate
in interface java.sql.Statement
executeUpdate
in class EmbedStatement
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothing
java.sql.SQLException
- thrown on failure.public final int executeUpdate(java.lang.String sql, int autoGenKeys) throws java.sql.SQLException
EmbedStatement
executeUpdate
in interface java.sql.Statement
executeUpdate
in class EmbedStatement
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingautoGenKeys
- - a flag indicating whether auto-generated keys
should be made available for retrieval; one of the following constants:
Statement.RETURN_GENERATED_KEYS Statement.NO_GENERATED_KEYS
java.sql.SQLException
- if a database access error occurspublic final int executeUpdate(java.lang.String sql, int[] columnIndexes) throws java.sql.SQLException
EmbedStatement
executeUpdate
in interface java.sql.Statement
executeUpdate
in class EmbedStatement
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingcolumnIndexes
- - an array of column indexes indicating the
columns that should be returned from the inserted row
java.sql.SQLException
- if a database access error occurspublic final int executeUpdate(java.lang.String sql, java.lang.String[] columnNames) throws java.sql.SQLException
EmbedStatement
executeUpdate
in interface java.sql.Statement
executeUpdate
in class EmbedStatement
sql
- a SQL INSERT, UPDATE or DELETE statement or a SQL
statement that returns nothingcolumnNames
- - an array of the names of the columns
that should be returned from the inserted row
java.sql.SQLException
- if a database access error occurspublic final void addBatch(java.lang.String sql) throws java.sql.SQLException
EmbedStatement
addBatch
in interface java.sql.Statement
addBatch
in class EmbedStatement
sql
- typically this is a static SQL INSERT or UPDATE statement
java.sql.SQLException
- if a database-access error occurs, or the
driver does not support batch statementsvoid closeActions() throws java.sql.SQLException
XAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource
Connection conn = xaconnection.getConnection();
PreparedStatement ps = conn.preparedStatement("values 1");
In the above case the PreparedStatement will actually be a
BrokeredPreparedStatement40 object. Hence when we call
bcc.onStatementClose and pass the PreparedStatement that caused it
applicationStatement will be the appropriate choice since it will
contain the appropriate instance of PreparedStatement in each case
closeActions
in class EmbedStatement
java.sql.SQLException
- upon failurepublic final java.sql.ResultSet executeQuery() throws java.sql.SQLException
executeQuery
in interface java.sql.PreparedStatement
java.sql.SQLException
- thrown on failure.public final int executeUpdate() throws java.sql.SQLException
executeUpdate
in interface java.sql.PreparedStatement
java.sql.SQLException
- thrown on failure.public void setNull(int parameterIndex, int sqlType) throws java.sql.SQLException
Note: You must specify the parameter's SQL type.
setNull
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...sqlType
- SQL type code defined by java.sql.Types
java.sql.SQLException
- thrown on failure.public void setBoolean(int parameterIndex, boolean x) throws java.sql.SQLException
setBoolean
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setByte(int parameterIndex, byte x) throws java.sql.SQLException
setByte
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setShort(int parameterIndex, short x) throws java.sql.SQLException
setShort
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setInt(int parameterIndex, int x) throws java.sql.SQLException
setInt
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setLong(int parameterIndex, long x) throws java.sql.SQLException
setLong
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setFloat(int parameterIndex, float x) throws java.sql.SQLException
setFloat
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setDouble(int parameterIndex, double x) throws java.sql.SQLException
setDouble
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setString(int parameterIndex, java.lang.String x) throws java.sql.SQLException
setString
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setBytes(int parameterIndex, byte[] x) throws java.sql.SQLException
setBytes
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setDate(int parameterIndex, java.sql.Date x) throws java.sql.SQLException
setDate
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setTime(int parameterIndex, java.sql.Time x) throws java.sql.SQLException
setTime
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public void setTimestamp(int parameterIndex, java.sql.Timestamp x) throws java.sql.SQLException
setTimestamp
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- thrown on failure.public final void setAsciiStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException
setAsciiStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the ASCII parameter valuelength
- the number of bytes in the stream
java.sql.SQLException
- thrown on failure.public final void setAsciiStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
setAsciiStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the ASCII parameter valuelength
- the number of bytes in the stream
java.sql.SQLException
- thrown on failure.public void setUnicodeStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
setUnicodeStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the
UNICODE parameter valuelength
- the number of bytes in the stream
java.sql.SQLException
- thrown on failure.public final void setCharacterStream(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
setCharacterStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...reader
- the java reader which contains the UNICODE datalength
- the number of characters in the stream
java.sql.SQLException
- if a database-access error occurs.public final void setCharacterStream(int parameterIndex, java.io.Reader reader, int length) throws java.sql.SQLException
Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.
setCharacterStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...reader
- the java reader which contains the UNICODE datalength
- the number of characters in the stream
java.sql.SQLException
- if a database-access error occurs.private final void checkCharacterStreamConditions(int parameterIndex) throws java.sql.SQLException
parameterIndex
- 1-based index of the parameter.
java.sql.SQLException
private final void checkAsciiStreamConditions(int parameterIndex) throws java.sql.SQLException
parameterIndex
- 1-based index of the parameter.
java.sql.SQLException
private void setCharacterStreamInternal(int parameterIndex, java.io.Reader reader, boolean lengthLess, long length) throws java.sql.SQLException
lengthLess
is true
, the following
conditions are either not checked or verified at the execution time
of the prepared statement:
lengthLess
variable was added to differentiate between
streams with invalid lengths and streams without known lengths.
parameterIndex
- the 1-based index of the parameter to set.reader
- the data.lengthLess
- tells whether we know the length of the data or not.length
- the length of the data. Ignored if lengthLess
is true
.
java.sql.SQLException
private java.lang.Boolean usePreTenFiveHdrFormat() throws StandardException
true
if the pre Derby 10.5 header format is to be used,
false
if the new header format can be used (10.5 or newer)
StandardException
- if obtaining the access mode failspublic void setBinaryStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException
LONGVARBINARY
parameter, it may be more practical to send it via a
java.io.InputStream
object. The data will be read from the
stream as needed until end-of-file is reached.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
setBinaryStream
in interface java.sql.PreparedStatement
setBinaryStream
in interface EnginePreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the binary parameter value
java.sql.SQLException
- if a database access error occurs or this method is
called on a closed PreparedStatement
public final void setBinaryStream(int parameterIndex, java.io.InputStream x, long length) throws java.sql.SQLException
setBinaryStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the binary parameter valuelength
- the number of bytes in the stream
java.sql.SQLException
- thrown on failure.public final void setBinaryStream(int parameterIndex, java.io.InputStream x, int length) throws java.sql.SQLException
setBinaryStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the java input stream which contains the binary parameter valuelength
- the number of bytes in the stream
java.sql.SQLException
- thrown on failure.private void setBinaryStreamInternal(int parameterIndex, java.io.InputStream x, boolean lengthLess, long length) throws java.sql.SQLException
lengthLess
is true
, the following
conditions are either not checked or verified at the execution time
of the prepared statement:
lengthLess
variable was added to differentiate between
streams with invalid lengths and streams without known lengths.
parameterIndex
- the 1-based index of the parameter to set.x
- the data.lengthLess
- tells whether we know the length of the data or not.length
- the length of the data. Ignored if lengthLess
is true
.
java.sql.SQLException
private final void checkBinaryStreamConditions(int parameterIndex) throws java.sql.SQLException
parameterIndex
- 1-based index of the parameter.
java.sql.SQLException
public void setNull(int paramIndex, int sqlType, java.lang.String typeName) throws java.sql.SQLException
NULL
.
This version of the method setNull
should
be used for user-defined types and REF type parameters. Examples
of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
named array types.
setNull
in interface java.sql.PreparedStatement
paramIndex
- the first parameter is 1, the second is 2, ...sqlType
- a value from java.sql.Types
typeName
- the fully-qualified name of an SQL user-defined type;
ignored if the parameter is not a user-defined type or REF
java.sql.SQLException
- if a database access error occurs or
this method is called on a closed PreparedStatement
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 type or if the JDBC driver does not support this methodpublic void addBatch() throws java.sql.SQLException
addBatch
in interface java.sql.PreparedStatement
java.sql.SQLException
- if a database-access error occurs.boolean executeBatchElement(java.lang.Object batchElement) throws java.sql.SQLException, StandardException
EmbedStatement
executeBatchElement
in class EmbedStatement
java.sql.SQLException
StandardException
public void clearParameters() throws java.sql.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 clearParameters.
clearParameters
in interface java.sql.PreparedStatement
java.sql.SQLException
- thrown on failure.public java.sql.ResultSetMetaData getMetaData() throws java.sql.SQLException
getMetaData
in interface java.sql.PreparedStatement
java.sql.SQLException
- Feature not implemented for now.public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType, int scale) throws java.sql.SQLException
If x is null, it won't tell us its type, so we pass it on to setNull
setObject
in interface java.sql.PreparedStatement
parameterIndex
- The first parameter is 1, the second is 2, ...x
- The object containing the input parameter valuetargetSqlType
- The SQL type (as defined in java.sql.Types) to be
sent to the database. The scale argument may further qualify this type.scale
- For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
this is the number of digits after the decimal. For all other
types this value will be ignored,
java.sql.SQLException
- thrown on failure.public final void setObject(int parameterIndex, java.lang.Object x, int targetSqlType) throws java.sql.SQLException
setObject
in interface java.sql.PreparedStatement
java.sql.SQLException
- thrown on failure.public final void setObject(int parameterIndex, java.lang.Object x) throws java.sql.SQLException
Set the value of a parameter using an object; use the java.lang equivalent objects for integral values.
The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding SQL type before being sent to the database.
Note that this method may be used to pass datatabase specific abstract data types, by using a Driver specific Java type.
setObject
in interface java.sql.PreparedStatement
parameterIndex
- The first parameter is 1, the second is 2, ...x
- The object containing the input parameter value
java.sql.SQLException
- thrown on failure.boolean setObjectConvert(int parameterIndex, java.lang.Object x) throws java.sql.SQLException
java.sql.SQLException
- value could not be set.public final boolean execute() throws java.sql.SQLException
execute
in interface java.sql.PreparedStatement
java.sql.SQLException
- thrown on failure.Statement.execute(java.lang.String)
public final void setDate(int parameterIndex, java.sql.Date x, java.util.Calendar cal) throws java.sql.SQLException
setDate
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- Feature not implemented for now.public final void setTime(int parameterIndex, java.sql.Time x, java.util.Calendar cal) throws java.sql.SQLException
setTime
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- Feature not implemented for now.public final void setTimestamp(int parameterIndex, java.sql.Timestamp x, java.util.Calendar cal) throws java.sql.SQLException
setTimestamp
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the parameter value
java.sql.SQLException
- Feature not implemented for now.public void setBlob(int i, java.sql.Blob x) throws java.sql.SQLException
setBlob
in interface java.sql.PreparedStatement
i
- the first parameter is 1, the second is 2, ...x
- an object representing a BLOB
java.sql.SQLException
private final void checkClobConditions(int parameterIndex) throws java.sql.SQLException
parameterIndex
- 1-based index of the parameter.
java.sql.SQLException
public void setClob(int i, java.sql.Clob x) throws java.sql.SQLException
setClob
in interface java.sql.PreparedStatement
i
- the first parameter is 1, the second is 2, ...x
- an object representing a CLOB
java.sql.SQLException
public final ParameterValueSet getParms()
protected final DataTypeDescriptor[] getTypes(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
- parameter is out of rangeprotected int getParameterJDBCType(int parameterIndex) throws java.sql.SQLException
java.sql.SQLException
- parameter is out of rangeprotected final java.lang.String getParameterSQLType(int parameterIndex) throws java.sql.SQLException
parameterIndex
- the 1-based index of the parameter
java.sql.SQLException
- if parameter is out of rangeprivate void setScale(int parameterIndex, int scale) throws java.sql.SQLException
parameterIndex
- The first parameter is 1, the second is 2, ...scale
- The scale
java.sql.SQLException
- thrown on failure.private EngineParameterMetaData getEmbedParameterSetMetaData() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occurspublic final void setURL(int parameterIndex, java.net.URL x) throws java.sql.SQLException
setURL
in interface java.sql.PreparedStatement
parameterIndex
- - the first parameter is 1, the second is 2, ...x
- - the java.net.URL object to be set
java.sql.SQLException
- Feature not implemented for now.protected EmbedResultSetMetaData newEmbedResultSetMetaData(ResultDescription resultDesc)
public java.lang.String toString()
toString
in class java.lang.Object
public void transferParameters(EmbedPreparedStatement newStatement) throws java.sql.SQLException
java.sql.SQLException
boolean executeStatement(Activation a, boolean executeQuery, boolean executeUpdate) throws java.sql.SQLException
EmbedStatement
executeStatement
in class EmbedStatement
java.sql.SQLException
- thrown on failure.final java.sql.SQLException dataTypeConversion(int column, java.lang.String sourceType) throws java.sql.SQLException
java.sql.SQLException
public void setBrokeredConnectionControl(BrokeredConnectionControl control)
control
- used to call the onStatementClose and
onStatementErrorOccurred methods that have logic to
raise StatementEvents for the close and error events
on the PreparedStatementprivate void checkStatementValidity(java.sql.SQLException sqle) throws java.sql.SQLException
XAConnection xaconn = xadatasource.getXAConnection();//where xadatasource is an object of XADataSource
Connection conn = xaconnection.getConnection();
PreparedStatement ps = conn.preparedStatement("values 1");
In the above case the PreparedStatement will actually be a
BrokeredPreparedStatement40 object. Hence when we call
bcc.onStatementClose and pass the PreparedStatement that caused it
applicationStatement will be the appropriate choice since it will
contain the appropriate instance of PreparedStatement in each case
java.sql.SQLException
private void checkForSupportedDataType(int dataType) throws java.sql.SQLException
setObject(int, Object, int)
and
setObject(int, Object, int, int)
.
dataType
- the data type to check
java.sql.SQLException
- if the type is not supportedpublic void setAsciiStream(int parameterIndex, java.io.InputStream x) throws java.sql.SQLException
LONGVARCHAR
parameter, it may be more practical to send it via a
java.io.InputStream
. Data will be read from the stream as
needed until end-of-file is reached. The JDBC driver will do any
necessary conversion from ASCII to the database char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
setAsciiStream
in interface java.sql.PreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...x
- the Java input stream that contains the ASCII parameter value
java.sql.SQLException
- if a database access error occurs or this method is
called on a closed PreparedStatement
public void setCharacterStream(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Reader
object.
When a very large UNICODE value is input to a LONGVARCHAR parameter, it
may be more practical to send it via a java.io.Reader
object. The data will be read from the stream as needed until
end-of-file is reached. The JDBC driver will do any necessary conversion
from UNICODE to the database char format.
Note: This stream object can either be a standard Java stream
object or your own subclass that implements the standard interface.
Using this lengthless overload is not less effective than using one
where the stream length is specified, but since there is no length
specified, the exact length check will not be performed.
setCharacterStream
in interface java.sql.PreparedStatement
setCharacterStream
in interface EnginePreparedStatement
parameterIndex
- the first parameter is 1, the second is 2, ...reader
- the java.io.Reader
object that contains the
Unicode data
java.sql.SQLException
- if a database access error occurs or this method is
called on a closed PreparedStatement
public void setClob(int parameterIndex, java.io.Reader reader) throws java.sql.SQLException
Reader
object.
This method differs from the setCharacterStream(int,Reader)
method because it informs the driver that the parameter value should be
sent to the server as a CLOB
. When the
setCharacterStream
method is used, the driver may have to
do extra work to determine whether the parameter data should be sent to
the server as a LONGVARCHAR
or a CLOB
.
setClob
in interface java.sql.PreparedStatement
parameterIndex
- index of the first parameter is 1, the second is
2, ...reader
- an object that contains the data to set the parameter
value to.
java.sql.SQLException
- if a database access error occurs, this method is
called on a closed PreparedStatementor if parameterIndex does not
correspond to a parameter marker in the SQL statementpublic void setClob(int parameterIndex, java.io.Reader reader, long length) throws java.sql.SQLException
setClob
in interface java.sql.PreparedStatement
parameterIndex
- index of the first parameter is 1, the second is 2, ...reader
- An object that contains the data to set the parameter value to.length
- the number of characters in the parameter data.
java.sql.SQLException
- if parameterIndex does not correspond to a parameter
marker in the SQL statement, or if the length specified is less than zero.public void setBlob(int parameterIndex, java.io.InputStream inputStream) throws java.sql.SQLException
InputStream
object.
This method differs from the setBinaryStream(int, InputStream)
method because it informs the driver that the parameter value
should be sent to the server as a BLOB
. When the
setBinaryStream
method is used, the driver may have to do
extra work to determine whether the parameter data should be sent to the
server as a LONGVARBINARY
or a BLOB
setBlob
in interface java.sql.PreparedStatement
parameterIndex
- index of the first parameter is 1, the second is
2, ...inputStream
- an object that contains the data to set the parameter
value to.
java.sql.SQLException
- if a database access error occurs, this method is
called on a closed PreparedStatement
or if
parameterIndex
does not correspond to a parameter
marker in the SQL statementpublic void setBlob(int parameterIndex, java.io.InputStream inputStream, long length) throws java.sql.SQLException
setBlob
in interface java.sql.PreparedStatement
parameterIndex
- index of the first parameter is 1,
the second is 2, ...inputStream
- An object that contains the data to set the parameter
value to.length
- the number of bytes in the parameter data.
java.sql.SQLException
- if parameterIndex does not correspond
to a parameter marker in the SQL statement, if the length specified
is less than zero or if the number of bytes in the inputstream does not match
the specfied length.private final void checkBlobConditions(int parameterIndex) throws java.sql.SQLException
parameterIndex
- 1-based index of the parameter.
java.sql.SQLException
|
Built on Thu 2011-03-10 11:54:14+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |