class DRDAStatement
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
DRDAStatement.DrdaParamState
This class is used to keep track of the statement's parameters
as they are received from the client.
|
Modifier and Type | Field and Description |
---|---|
protected int |
blksize |
protected int |
byteOrder |
protected int |
ccsidDBC |
protected java.lang.String |
ccsidDBCEncoding |
protected int |
ccsidMBC |
protected java.lang.String |
ccsidMBCEncoding |
protected int |
ccsidSBC |
protected java.lang.String |
ccsidSBCEncoding |
protected int |
concurType |
private DRDAResultSet |
currentDrdaRs |
protected java.lang.String |
cursorName |
protected Database |
database |
private DRDAStatement.DrdaParamState |
drdaParamState_ |
(package private) boolean |
explicitlyPrepared |
protected boolean |
isCall |
protected int |
isolationLevel |
protected int |
maxblkext |
protected int |
maxrslcnt |
protected int |
nbrrow |
(package private) boolean |
needsToSendParamData |
protected static int |
NOT_OUTPUT_PARAM |
private int |
numResultSets |
protected int |
outovropt |
protected boolean |
outputExpected |
private int[] |
outputPrecision |
private int[] |
outputScale |
private int[] |
outputTypes |
private Pkgnamcsn |
pkgnamcsn |
protected java.lang.String |
procName |
protected EnginePreparedStatement |
ps |
private int |
qryprctyp |
protected boolean |
qryrfrtbl |
protected int |
qryrowset |
private java.util.ArrayList<ConsistencyToken> |
resultSetKeyList
Ordered list of hash keys.
|
private java.util.Hashtable<ConsistencyToken,DRDAResultSet> |
resultSetTable
Hashtable with resultsets.
|
protected long |
rowCount |
protected byte[] |
rslsetflg |
protected int |
scrollType |
(package private) int |
sqldaType
Saved value returned from
DRDAConnThread.parsePRPSQLSTT() . |
private EngineStatement |
stmt |
protected java.sql.ParameterMetaData |
stmtPmeta |
private java.sql.DataTruncation |
truncationWarnings
A chain of warnings indicating whether some of the data values returned
by this statement had to be truncated before being sent to the client.
|
protected java.lang.String |
typDefNam |
(package private) long |
versionCounter
If this changes, we need to re-send result set metadata to client, since
a change indicates the engine has recompiled the prepared statement.
|
(package private) int |
withHoldCursor |
Constructor and Description |
---|
DRDAStatement(Database database)
DRDAStatement constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
addDrdaParam(byte t,
int l)
Add another parameter to this statement.
|
protected void |
addExtDtaObject(java.lang.Object o,
int jdbcIndex)
Add extDtaObject
|
protected void |
addExtPosition(int pos)
Mark the pos'th parameter as external
|
protected ConsistencyToken |
addResultSet(java.sql.ResultSet value,
int holdValue)
Add a new resultSet to this statement.
|
protected void |
addTruncationWarning(java.sql.DataTruncation w)
Add a warning about data having been truncated.
|
protected ConsistencyToken |
calculateResultSetPkgcnstkn(int rsNum)
For a single result set, just echo the consistency token that the client sent us.
|
protected void |
clearDrdaParams()
Clears the parameter state (type, length and ext information)
stored in this statement, but does not release any
storage.
|
protected void |
clearExtDtaObjects()
Clear externalized lob objects in current result set
|
protected void |
clearTruncationWarnings()
Clear the chain of truncation warnings for this statement.
|
protected void |
close()
This method closes the JDBC objects and frees up all references held by
this object.
|
protected void |
CLSQRY()
Explicitly close the result set by CLSQRY
needed to check for double close.
|
protected boolean |
execute()
Executes the prepared statement and populates the resultSetTable.
|
protected java.sql.PreparedStatement |
explicitPrepare(java.lang.String sqlStmt) |
protected void |
finishParams()
clear out type data for parameters.
|
protected int |
getBlksize() |
protected int |
getConcurType() |
protected DRDAResultSet |
getCurrentDrdaResultSet()
Gets the current DRDA ResultSet
|
protected int |
getDrdaParamCount()
Get the number of parameters, internal and external, that has
been added to this statement.
|
private DRDAResultSet |
getDrdaResultSet(ConsistencyToken consistToken) |
private DRDAResultSet |
getDrdaResultSet(int rsNum) |
protected java.util.ArrayList<java.lang.Object> |
getExtDtaObjects()
Get the extData Objects
|
protected int |
getExtPosition(int i)
Get the parameter position of the i'th external parameter
|
protected int |
getExtPositionCount()
Get the number of external parameters in this
statement.
|
private boolean |
getMoreResults(int current)
get more results using reflection.
|
protected int |
getNumResultSets() |
protected int |
getNumRsCols()
get the number of result set columns for the current resultSet
|
protected int[] |
getOutovr_drdaType() |
protected static int |
getOutputParameterTypeFromClassName(java.lang.String objectName)
Given an object class name get the paramameter type if the
parameter mode is unknown.
|
(package private) int |
getOutputParamPrecision(int paramNum)
get precision for output parameter.
|
(package private) int |
getOutputParamScale(int paramNum)
get scale for output parameter.
|
(package private) int |
getOutputParamType(int paramNum)
get type for output parameter.
|
protected int |
getParamDRDAType(int index)
get parameter DRDAType
|
protected java.sql.ParameterMetaData |
getParameterMetaData()
Retrieve the ParameterMetaData for the prepared statement.
|
protected int |
getParamLen(int index)
returns drda length of parameter as sent by client.
|
protected int |
getParamPrecision(int index)
get parameter precision or DB2 max (31)
|
protected int |
getParamScale(int index)
get parameter scale or DB2 max (31)
|
protected Pkgnamcsn |
getPkgnamcsn()
Get pkgnamcsn
|
protected EnginePreparedStatement |
getPreparedStatement()
Get prepared statement
|
protected int |
getQryprctyp() |
protected long |
getQryrownbr() |
protected int |
getQryrowset() |
protected boolean |
getQryrtndta() |
protected int |
getQryscrorn() |
protected java.sql.ResultSet |
getResultSet()
Get result set
|
java.lang.String |
getResultSetCursorName(int rsNum) |
protected ConsistencyToken |
getResultSetPkgcnstkn(int rsNum) |
protected int |
getRsDRDAType(int index)
get resultset/out parameter DRDAType
|
protected int[] |
getRsDRDATypes() |
protected int |
getRsLen(int index)
get resultset/out parameter DRDALen
|
protected int |
getRsPrecision(int index)
get resultset /out parameter precision
|
protected int |
getRsScale(int index)
get resultset /out parameter scale
|
protected int |
getScrollType() |
byte[] |
getSplitQRYDTA() |
private java.lang.String |
getSQLText()
Use reflection to retrieve SQL Text for EmbedPreparedStatement
or BrokeredPreparedStatement.
|
protected EngineStatement |
getStatement()
Get the statement
|
private int |
getStaticPackageIsolation(java.lang.String pkgid)
get the isolation level for a static package.
|
protected java.sql.DataTruncation |
getTruncationWarnings()
Get the chain of truncation warnings added to this statement.
|
protected boolean |
hasdata() |
protected boolean |
hasOutputParams() |
protected void |
initialize()
This method is used to initialize the default statement of the database
for re-use.
|
private boolean |
isCallableSQL(java.lang.String sql) |
protected boolean |
isCallableStatement() |
private boolean |
isDynamicPkgid(java.lang.String pkgid) |
protected boolean |
isExtDtaValueNullable(int index) |
(package private) boolean |
isOutputParam(int paramNum)
is parameter an ouput parameter
|
(package private) boolean |
isRSCloseImplicit(boolean lmtblkprcOK)
Method to decide whether the ResultSet should be closed
implicitly based on the QRYCLSIMP value sent from the
client.
|
protected boolean |
isScrollable()
is this a scrollable cursor?
|
private void |
parsePkgidToFindHoldability() |
protected java.sql.PreparedStatement |
prepare(java.lang.String sqlStmt)
Create a prepared statement
|
void |
registerAllOutParams() |
void |
registerOutParam(int paramNum) |
protected void |
reset()
This method resets the state of this DRDAStatement object so that it can
be re-used.
|
protected void |
rsClose()
Close the current resultSet
|
protected boolean |
rsIsClosed()
is Statement closed
|
protected void |
rsSuspend()
Set state to SUSPENDED (result set is opened)
|
protected void |
setConcurType(int scrollType) |
protected void |
setCurrentDrdaResultSet(int rsNum)
Set currentDrdaResultSet
|
protected void |
setCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)
Set currentDrdaResultSet
|
protected void |
setDatabase(Database database)
Set database
|
protected void |
setHasdata(boolean hasdata) |
protected void |
setOPNQRYOptions(int blksize,
int qryblkctl,
int maxblkext,
int outovropt,
int qryrowset,
int qryclsimpl)
Set query options sent on OPNQRY and pass options down to the
current
DRDAResultSet object. |
protected void |
setOutovr_drdaType(int[] outovr_drdaType) |
protected void |
setPkgnamcsn(Pkgnamcsn pkgnamcsn)
Set the pkgid sec num for this statement and the
consistency token that will be used for the first resultSet.
|
protected void |
setQryprctyp(int qryprctyp) |
protected void |
setQryrownbr(long qryrownbr) |
protected void |
setQryrtndta(boolean qryrtndta) |
protected void |
setQryscrorn(int qryscrorn) |
protected void |
setQueryOptions(int blksize,
boolean qryrelscr,
long qryrownbr,
boolean qryfrtbl,
int nbrrow,
int maxblkext,
int qryscrorn,
boolean qryrowsns,
boolean qryblkrst,
boolean qryrtndta,
int qryrowset,
int rtnextdta) |
protected void |
setRsDefaultOptions(DRDAResultSet drs)
Set resultSet defaults to match
the statement defaults sent on EXCSQLSTT
This might be overridden on OPNQRY or CNTQRY
|
protected void |
setRsDRDAType(int index,
int type)
set result DRDAType
|
protected void |
setRsPrecision(int index,
int precision)
set resultset/out parameter precision
|
protected void |
setRsScale(int index,
int scale)
set resultset/out parameter scale
|
protected void |
setScrollType(int scrollType) |
void |
setSplitQRYDTA(byte[] data) |
protected void |
setStatement(java.sql.Connection conn)
Set statement
|
protected void |
setStreamedParameter(EXTDTAReaderInputStream eis) |
protected void |
setTypDefValues()
set TypDef values
|
private void |
setupCallableStatementParams(java.sql.CallableStatement cs) |
protected java.lang.String |
toDebugString(java.lang.String indent) |
protected boolean |
wasExplicitlyClosed() |
protected boolean |
wasExplicitlyPrepared() |
protected java.lang.String typDefNam
protected int byteOrder
protected int ccsidSBC
protected int ccsidDBC
protected int ccsidMBC
protected java.lang.String ccsidSBCEncoding
protected java.lang.String ccsidDBCEncoding
protected java.lang.String ccsidMBCEncoding
protected Database database
private Pkgnamcsn pkgnamcsn
int withHoldCursor
protected int isolationLevel
protected java.lang.String cursorName
protected int scrollType
protected int concurType
protected long rowCount
protected byte[] rslsetflg
protected int maxrslcnt
protected EnginePreparedStatement ps
protected java.sql.ParameterMetaData stmtPmeta
protected boolean isCall
protected java.lang.String procName
private int[] outputTypes
private int[] outputPrecision
private int[] outputScale
protected static int NOT_OUTPUT_PARAM
protected boolean outputExpected
private EngineStatement stmt
private DRDAResultSet currentDrdaRs
private java.util.Hashtable<ConsistencyToken,DRDAResultSet> resultSetTable
private java.util.ArrayList<ConsistencyToken> resultSetKeyList
private int numResultSets
private java.sql.DataTruncation truncationWarnings
private DRDAStatement.DrdaParamState drdaParamState_
protected int nbrrow
protected int qryrowset
protected int blksize
protected int maxblkext
protected int outovropt
protected boolean qryrfrtbl
private int qryprctyp
boolean needsToSendParamData
boolean explicitlyPrepared
long versionCounter
int sqldaType
DRDAConnThread.parsePRPSQLSTT()
.
Used to determine if the statement is such that we may
need to re-send metadata at execute time, see versionCounter
.DRDAStatement(Database database)
database
- protected void setTypDefValues()
protected void setDatabase(Database database)
database
- protected void setStatement(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connectionjava.sql.SQLException
protected EngineStatement getStatement() throws java.sql.SQLException
java.sql.SQLException
protected void addTruncationWarning(java.sql.DataTruncation w)
w
- the warning to addprotected java.sql.DataTruncation getTruncationWarnings()
null
protected void clearTruncationWarnings()
protected void setRsDefaultOptions(DRDAResultSet drs)
protected java.util.ArrayList<java.lang.Object> getExtDtaObjects()
public void setSplitQRYDTA(byte[] data)
public byte[] getSplitQRYDTA()
protected void addExtDtaObject(java.lang.Object o, int jdbcIndex)
o
- - object to addjdbcIndex
- - jdbc index for parameterprotected void clearExtDtaObjects()
protected boolean isExtDtaValueNullable(int index)
protected void setOPNQRYOptions(int blksize, int qryblkctl, int maxblkext, int outovropt, int qryrowset, int qryclsimpl)
DRDAResultSet
object.blksize
- QRYBLKSZ (Query Block Size)qryblkctl
- QRYPRCTYP (Query Protocol Type)maxblkext
- MAXBLKEXT (Maximum Number of Extra Blocks)outovropt
- OUTOVROPT (Output Override Option)qryrowset
- QRYROWSET (Query Rowset Size)qryclsimpl
- QRYCLSIMP (Query Close Implicit)DRDAResultSet.setOPNQRYOptions(int, int, int, int, int, int)
protected void setQueryOptions(int blksize, boolean qryrelscr, long qryrownbr, boolean qryfrtbl, int nbrrow, int maxblkext, int qryscrorn, boolean qryrowsns, boolean qryblkrst, boolean qryrtndta, int qryrowset, int rtnextdta)
protected void setQryprctyp(int qryprctyp)
protected int getQryprctyp() throws java.sql.SQLException
java.sql.SQLException
protected void setQryrownbr(long qryrownbr)
protected long getQryrownbr()
protected int getQryrowset()
protected int getBlksize()
protected void setQryrtndta(boolean qryrtndta)
protected boolean getQryrtndta()
protected void setQryscrorn(int qryscrorn)
protected int getQryscrorn()
protected void setScrollType(int scrollType)
protected int getScrollType()
protected boolean isScrollable()
protected void setConcurType(int scrollType)
protected int getConcurType()
protected void setOutovr_drdaType(int[] outovr_drdaType)
protected int[] getOutovr_drdaType()
protected boolean hasdata()
protected void setHasdata(boolean hasdata)
protected void initialize()
protected java.sql.PreparedStatement explicitPrepare(java.lang.String sqlStmt) throws java.sql.SQLException
java.sql.SQLException
protected boolean wasExplicitlyPrepared()
protected java.sql.PreparedStatement prepare(java.lang.String sqlStmt) throws java.sql.SQLException
sqlStmt
- - SQL statementjava.sql.SQLException
protected EnginePreparedStatement getPreparedStatement() throws java.sql.SQLException
java.sql.SQLException
protected boolean execute() throws java.sql.SQLException
java.sql.SQLException
protected void finishParams()
protected void setPkgnamcsn(Pkgnamcsn pkgnamcsn)
pkgnamcsn
- package id section number and token from the clientprivate int getStaticPackageIsolation(java.lang.String pkgid)
pkgid
- - Package identifier string (e.g. SYSSTAT)protected Pkgnamcsn getPkgnamcsn()
protected java.sql.ResultSet getResultSet()
protected DRDAResultSet getCurrentDrdaResultSet()
protected void setCurrentDrdaResultSet(int rsNum)
rsNum
- The result set number starting with 0protected void setCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)
pkgnamcsn
- The pkgid section number and unique resultset
consistency tokenprivate DRDAResultSet getDrdaResultSet(ConsistencyToken consistToken)
private DRDAResultSet getDrdaResultSet(int rsNum)
protected ConsistencyToken addResultSet(java.sql.ResultSet value, int holdValue) throws java.sql.SQLException
value
- - ResultSet to addholdValue
- - Holdability of the ResultSetjava.sql.SQLException
protected int getNumResultSets()
protected ConsistencyToken getResultSetPkgcnstkn(int rsNum)
rsNum
- result set starting with 0protected int[] getRsDRDATypes()
protected void rsClose() throws java.sql.SQLException
java.sql.SQLException
protected void CLSQRY()
protected boolean wasExplicitlyClosed()
protected void close() throws java.sql.SQLException
java.sql.SQLException
protected void reset()
protected boolean rsIsClosed()
protected void rsSuspend()
protected void setRsPrecision(int index, int precision)
index
- - starting with 1precision
- protected int getRsPrecision(int index)
index
- -starting with 1protected void setRsScale(int index, int scale)
index
- - starting with 1scale
- protected int getRsScale(int index)
index
- -starting with 1protected void setRsDRDAType(int index, int type)
index
- - starting with 1type
- protected void clearDrdaParams()
protected int getExtPositionCount()
protected int getExtPosition(int i)
i
- - zero-based index into list of external parametersprotected void addExtPosition(int pos)
pos
- - zero-based index into list of external parametersprotected int getDrdaParamCount()
protected void addDrdaParam(byte t, int l)
t
- - type of the parameterl
- - length in bytes of the parameterprotected void setStreamedParameter(EXTDTAReaderInputStream eis)
protected int getParamDRDAType(int index)
index
- - starting with 1protected int getParamLen(int index)
index
- - starting with 1protected int getParamPrecision(int index) throws java.sql.SQLException
index
- parameter index starting with 1java.sql.SQLException
protected int getParamScale(int index) throws java.sql.SQLException
index
- parameter index starting with 1java.sql.SQLException
protected int getNumRsCols()
protected int getRsDRDAType(int index)
index
- - starting with 1protected int getRsLen(int index)
index
- starting with 1public java.lang.String getResultSetCursorName(int rsNum) throws java.sql.SQLException
rsNum
- - result set # starting with 0java.sql.SQLException
protected java.lang.String toDebugString(java.lang.String indent)
protected ConsistencyToken calculateResultSetPkgcnstkn(int rsNum)
rsNum
- - result set # starting with 0protected boolean isCallableStatement()
private boolean isCallableSQL(java.lang.String sql)
private void setupCallableStatementParams(java.sql.CallableStatement cs) throws java.sql.SQLException
java.sql.SQLException
protected static int getOutputParameterTypeFromClassName(java.lang.String objectName)
objectName
- Class name of object being evaluated.
indicating if this an output parameterpublic void registerAllOutParams() throws java.sql.SQLException
java.sql.SQLException
public void registerOutParam(int paramNum) throws java.sql.SQLException
java.sql.SQLException
protected boolean hasOutputParams()
boolean isOutputParam(int paramNum)
paramNum
- parameter number starting with 1.
return true if this is an output parameter.int getOutputParamType(int paramNum)
paramNum
- - parameter number starting with 1int getOutputParamScale(int paramNum)
paramNum
- - parameter number starting with 1int getOutputParamPrecision(int paramNum)
paramNum
- - parameter number starting with 1private boolean isDynamicPkgid(java.lang.String pkgid)
private void parsePkgidToFindHoldability()
protected java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLException
java.sql.SQLException
private boolean getMoreResults(int current) throws java.sql.SQLException
current
- - flag to pass to Statement.getMoreResults(current)java.sql.SQLException
Statement.getMoreResults()
private java.lang.String getSQLText()
boolean isRSCloseImplicit(boolean lmtblkprcOK) throws java.sql.SQLException
lmtblkprcOK
- true
if the client expects
QRYCLSIMP to be respected for the LMTBLKPRC protocoljava.sql.SQLException
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.