Package org.apache.derby.impl.drda
Class DRDAStatement
- java.lang.Object
-
- org.apache.derby.impl.drda.DRDAStatement
-
class DRDAStatement extends java.lang.ObjectDRDAStatement stores information about the statement being executed
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDRDAStatement.DrdaParamStateThis class is used to keep track of the statement's parameters as they are received from the client.
-
Field Summary
Fields Modifier and Type Field Description protected intblksizeprotected intbyteOrderprotected intccsidDBCprotected java.lang.StringccsidDBCEncodingprotected intccsidMBCprotected java.lang.StringccsidMBCEncodingprotected intccsidSBCprotected java.lang.StringccsidSBCEncodingprotected intconcurTypeprivate DRDAResultSetcurrentDrdaRsprotected java.lang.StringcursorNameprotected Databasedatabaseprivate DRDAStatement.DrdaParamStatedrdaParamState_(package private) booleanexplicitlyPreparedprotected booleanisCallprotected intisolationLevelprotected intmaxblkextprotected intmaxrslcntprotected intnbrrow(package private) booleanneedsToSendParamDataprotected static intNOT_OUTPUT_PARAMprivate intnumResultSetsprotected intoutovroptprotected booleanoutputExpectedprivate int[]outputPrecisionprivate int[]outputScaleprivate int[]outputTypesprivate Pkgnamcsnpkgnamcsnprotected java.lang.StringprocNameprotected EnginePreparedStatementpsprivate intqryprctypprotected booleanqryrfrtblprotected intqryrowsetprivate java.util.ArrayList<ConsistencyToken>resultSetKeyListOrdered list of hash keys.private java.util.Hashtable<ConsistencyToken,DRDAResultSet>resultSetTableHashtable with resultsets.protected longrowCountprotected byte[]rslsetflgprotected intscrollType(package private) intsqldaTypeSaved value returned fromDRDAConnThread.parsePRPSQLSTT().private EngineStatementstmtprotected java.sql.ParameterMetaDatastmtPmetaprivate java.sql.DataTruncationtruncationWarningsA 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.StringtypDefNam(package private) longversionCounterIf 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) intwithHoldCursor
-
Constructor Summary
Constructors Constructor Description DRDAStatement(Database database)DRDAStatement constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddDrdaParam(byte t, int l)Add another parameter to this statement.protected voidaddExtDtaObject(java.lang.Object o, int jdbcIndex)Add extDtaObjectprotected voidaddExtPosition(int pos)Mark the pos'th parameter as externalprotected ConsistencyTokenaddResultSet(java.sql.ResultSet value, int holdValue)Add a new resultSet to this statement.protected voidaddTruncationWarning(java.sql.DataTruncation w)Add a warning about data having been truncated.protected ConsistencyTokencalculateResultSetPkgcnstkn(int rsNum)For a single result set, just echo the consistency token that the client sent us.protected voidclearDrdaParams()Clears the parameter state (type, length and ext information) stored in this statement, but does not release any storage.protected voidclearExtDtaObjects()Clear externalized lob objects in current result setprotected voidclearTruncationWarnings()Clear the chain of truncation warnings for this statement.protected voidclose()This method closes the JDBC objects and frees up all references held by this object.protected voidCLSQRY()Explicitly close the result set by CLSQRY needed to check for double close.protected booleanexecute()Executes the prepared statement and populates the resultSetTable.protected java.sql.PreparedStatementexplicitPrepare(java.lang.String sqlStmt)protected voidfinishParams()clear out type data for parameters.protected intgetBlksize()protected intgetConcurType()protected DRDAResultSetgetCurrentDrdaResultSet()Gets the current DRDA ResultSetprotected intgetDrdaParamCount()Get the number of parameters, internal and external, that has been added to this statement.private DRDAResultSetgetDrdaResultSet(int rsNum)private DRDAResultSetgetDrdaResultSet(ConsistencyToken consistToken)protected java.util.ArrayList<java.lang.Object>getExtDtaObjects()Get the extData Objectsprotected intgetExtPosition(int i)Get the parameter position of the i'th external parameterprotected intgetExtPositionCount()Get the number of external parameters in this statement.private booleangetMoreResults(int current)get more results using reflection.protected intgetNumResultSets()protected intgetNumRsCols()get the number of result set columns for the current resultSetprotected int[]getOutovr_drdaType()protected static intgetOutputParameterTypeFromClassName(java.lang.String objectName)Given an object class name get the paramameter type if the parameter mode is unknown.(package private) intgetOutputParamPrecision(int paramNum)get precision for output parameter.(package private) intgetOutputParamScale(int paramNum)get scale for output parameter.(package private) intgetOutputParamType(int paramNum)get type for output parameter.protected intgetParamDRDAType(int index)get parameter DRDATypeprotected java.sql.ParameterMetaDatagetParameterMetaData()Retrieve the ParameterMetaData for the prepared statement.protected intgetParamLen(int index)returns drda length of parameter as sent by client.protected intgetParamPrecision(int index)get parameter precision or DB2 max (31)protected intgetParamScale(int index)get parameter scale or DB2 max (31)protected PkgnamcsngetPkgnamcsn()Get pkgnamcsnprotected EnginePreparedStatementgetPreparedStatement()Get prepared statementprotected intgetQryprctyp()protected longgetQryrownbr()protected intgetQryrowset()protected booleangetQryrtndta()protected intgetQryscrorn()protected java.sql.ResultSetgetResultSet()Get result setjava.lang.StringgetResultSetCursorName(int rsNum)protected ConsistencyTokengetResultSetPkgcnstkn(int rsNum)protected intgetRsDRDAType(int index)get resultset/out parameter DRDATypeprotected int[]getRsDRDATypes()protected intgetRsLen(int index)get resultset/out parameter DRDALenprotected intgetRsPrecision(int index)get resultset /out parameter precisionprotected intgetRsScale(int index)get resultset /out parameter scaleprotected intgetScrollType()byte[]getSplitQRYDTA()private java.lang.StringgetSQLText()Use reflection to retrieve SQL Text for EmbedPreparedStatement or BrokeredPreparedStatement.protected EngineStatementgetStatement()Get the statementprivate intgetStaticPackageIsolation(java.lang.String pkgid)get the isolation level for a static package.protected java.sql.DataTruncationgetTruncationWarnings()Get the chain of truncation warnings added to this statement.protected booleanhasdata()protected booleanhasOutputParams()protected voidinitialize()This method is used to initialize the default statement of the database for re-use.private booleanisCallableSQL(java.lang.String sql)protected booleanisCallableStatement()private booleanisDynamicPkgid(java.lang.String pkgid)protected booleanisExtDtaValueNullable(int index)(package private) booleanisOutputParam(int paramNum)is parameter an ouput parameter(package private) booleanisRSCloseImplicit(boolean lmtblkprcOK)Method to decide whether the ResultSet should be closed implicitly based on the QRYCLSIMP value sent from the client.protected booleanisScrollable()is this a scrollable cursor?private voidparsePkgidToFindHoldability()protected java.sql.PreparedStatementprepare(java.lang.String sqlStmt)Create a prepared statementvoidregisterAllOutParams()voidregisterOutParam(int paramNum)protected voidreset()This method resets the state of this DRDAStatement object so that it can be re-used.protected voidrsClose()Close the current resultSetprotected booleanrsIsClosed()is Statement closedprotected voidrsSuspend()Set state to SUSPENDED (result set is opened)protected voidsetConcurType(int scrollType)protected voidsetCurrentDrdaResultSet(int rsNum)Set currentDrdaResultSetprotected voidsetCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)Set currentDrdaResultSetprotected voidsetDatabase(Database database)Set databaseprotected voidsetHasdata(boolean hasdata)protected voidsetOPNQRYOptions(int blksize, int qryblkctl, int maxblkext, int outovropt, int qryrowset, int qryclsimpl)Set query options sent on OPNQRY and pass options down to the currentDRDAResultSetobject.protected voidsetOutovr_drdaType(int[] outovr_drdaType)protected voidsetPkgnamcsn(Pkgnamcsn pkgnamcsn)Set the pkgid sec num for this statement and the consistency token that will be used for the first resultSet.protected voidsetQryprctyp(int qryprctyp)protected voidsetQryrownbr(long qryrownbr)protected voidsetQryrtndta(boolean qryrtndta)protected voidsetQryscrorn(int qryscrorn)protected voidsetQueryOptions(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 voidsetRsDefaultOptions(DRDAResultSet drs)Set resultSet defaults to match the statement defaults sent on EXCSQLSTT This might be overridden on OPNQRY or CNTQRYprotected voidsetRsDRDAType(int index, int type)set result DRDATypeprotected voidsetRsPrecision(int index, int precision)set resultset/out parameter precisionprotected voidsetRsScale(int index, int scale)set resultset/out parameter scaleprotected voidsetScrollType(int scrollType)voidsetSplitQRYDTA(byte[] data)protected voidsetStatement(java.sql.Connection conn)Set statementprotected voidsetStreamedParameter(EXTDTAReaderInputStream eis)protected voidsetTypDefValues()set TypDef valuesprivate voidsetupCallableStatementParams(java.sql.CallableStatement cs)protected java.lang.StringtoDebugString(java.lang.String indent)protected booleanwasExplicitlyClosed()protected booleanwasExplicitlyPrepared()
-
-
-
Field Detail
-
typDefNam
protected java.lang.String typDefNam
-
byteOrder
protected int byteOrder
-
ccsidSBC
protected int ccsidSBC
-
ccsidDBC
protected int ccsidDBC
-
ccsidMBC
protected int ccsidMBC
-
ccsidSBCEncoding
protected java.lang.String ccsidSBCEncoding
-
ccsidDBCEncoding
protected java.lang.String ccsidDBCEncoding
-
ccsidMBCEncoding
protected java.lang.String ccsidMBCEncoding
-
database
protected Database database
-
pkgnamcsn
private Pkgnamcsn pkgnamcsn
-
withHoldCursor
int withHoldCursor
-
isolationLevel
protected int isolationLevel
-
cursorName
protected java.lang.String cursorName
-
scrollType
protected int scrollType
-
concurType
protected int concurType
-
rowCount
protected long rowCount
-
rslsetflg
protected byte[] rslsetflg
-
maxrslcnt
protected int maxrslcnt
-
ps
protected EnginePreparedStatement ps
-
stmtPmeta
protected java.sql.ParameterMetaData stmtPmeta
-
isCall
protected boolean isCall
-
procName
protected java.lang.String procName
-
outputTypes
private int[] outputTypes
-
outputPrecision
private int[] outputPrecision
-
outputScale
private int[] outputScale
-
NOT_OUTPUT_PARAM
protected static int NOT_OUTPUT_PARAM
-
outputExpected
protected boolean outputExpected
-
stmt
private EngineStatement stmt
-
currentDrdaRs
private DRDAResultSet currentDrdaRs
-
resultSetTable
private java.util.Hashtable<ConsistencyToken,DRDAResultSet> resultSetTable
Hashtable with resultsets.
-
resultSetKeyList
private java.util.ArrayList<ConsistencyToken> resultSetKeyList
Ordered list of hash keys.
-
numResultSets
private int numResultSets
-
truncationWarnings
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.
-
drdaParamState_
private DRDAStatement.DrdaParamState drdaParamState_
-
nbrrow
protected int nbrrow
-
qryrowset
protected int qryrowset
-
blksize
protected int blksize
-
maxblkext
protected int maxblkext
-
outovropt
protected int outovropt
-
qryrfrtbl
protected boolean qryrfrtbl
-
qryprctyp
private int qryprctyp
-
needsToSendParamData
boolean needsToSendParamData
-
explicitlyPrepared
boolean explicitlyPrepared
-
versionCounter
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.
-
sqldaType
int sqldaType
Saved value returned fromDRDAConnThread.parsePRPSQLSTT(). Used to determine if the statement is such that we may need to re-send metadata at execute time, seeversionCounter.
-
-
Constructor Detail
-
DRDAStatement
DRDAStatement(Database database)
DRDAStatement constructor- Parameters:
database-
-
-
Method Detail
-
setTypDefValues
protected void setTypDefValues()
set TypDef values
-
setDatabase
protected void setDatabase(Database database)
Set database- Parameters:
database-
-
setStatement
protected void setStatement(java.sql.Connection conn) throws java.sql.SQLExceptionSet statement- Parameters:
conn- Connection- Throws:
java.sql.SQLException
-
getStatement
protected EngineStatement getStatement() throws java.sql.SQLException
Get the statement- Returns:
- statement
- Throws:
java.sql.SQLException
-
addTruncationWarning
protected void addTruncationWarning(java.sql.DataTruncation w)
Add a warning about data having been truncated.- Parameters:
w- the warning to add
-
getTruncationWarnings
protected java.sql.DataTruncation getTruncationWarnings()
Get the chain of truncation warnings added to this statement.- Returns:
- chain of truncation warnings, possibly
null
-
clearTruncationWarnings
protected void clearTruncationWarnings()
Clear the chain of truncation warnings for this statement.
-
setRsDefaultOptions
protected void setRsDefaultOptions(DRDAResultSet drs)
Set resultSet defaults to match the statement defaults sent on EXCSQLSTT This might be overridden on OPNQRY or CNTQRY
-
getExtDtaObjects
protected java.util.ArrayList<java.lang.Object> getExtDtaObjects()
Get the extData Objects- Returns:
- ArrayList with extdta
-
setSplitQRYDTA
public void setSplitQRYDTA(byte[] data)
-
getSplitQRYDTA
public byte[] getSplitQRYDTA()
-
addExtDtaObject
protected void addExtDtaObject(java.lang.Object o, int jdbcIndex)Add extDtaObject- Parameters:
o- - object to addjdbcIndex- - jdbc index for parameter
-
clearExtDtaObjects
protected void clearExtDtaObjects()
Clear externalized lob objects in current result set
-
isExtDtaValueNullable
protected boolean isExtDtaValueNullable(int index)
-
setOPNQRYOptions
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 currentDRDAResultSetobject.- Parameters:
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)- See Also:
DRDAResultSet.setOPNQRYOptions(int, int, int, int, int, int)
-
setQueryOptions
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)
-
setQryprctyp
protected void setQryprctyp(int qryprctyp)
-
getQryprctyp
protected int getQryprctyp() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setQryrownbr
protected void setQryrownbr(long qryrownbr)
-
getQryrownbr
protected long getQryrownbr()
-
getQryrowset
protected int getQryrowset()
-
getBlksize
protected int getBlksize()
-
setQryrtndta
protected void setQryrtndta(boolean qryrtndta)
-
getQryrtndta
protected boolean getQryrtndta()
-
setQryscrorn
protected void setQryscrorn(int qryscrorn)
-
getQryscrorn
protected int getQryscrorn()
-
setScrollType
protected void setScrollType(int scrollType)
-
getScrollType
protected int getScrollType()
-
isScrollable
protected boolean isScrollable()
is this a scrollable cursor? return true if this is not a forward only cursor
-
setConcurType
protected void setConcurType(int scrollType)
-
getConcurType
protected int getConcurType()
-
setOutovr_drdaType
protected void setOutovr_drdaType(int[] outovr_drdaType)
-
getOutovr_drdaType
protected int[] getOutovr_drdaType()
-
hasdata
protected boolean hasdata()
-
setHasdata
protected void setHasdata(boolean hasdata)
-
initialize
protected void initialize()
This method is used to initialize the default statement of the database for re-use. It is different from reset() method since default statements get initialized differently. e.g: stmt variable used in default statement is created only once in Database.makeConnection. The default statement will be initialized to have the same byte order etc as the server. This may be changed when a TYPEDEFNAM is received from the client in DRDAConnThread.setStmtOrDbByteOrder()
-
explicitPrepare
protected java.sql.PreparedStatement explicitPrepare(java.lang.String sqlStmt) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
wasExplicitlyPrepared
protected boolean wasExplicitlyPrepared()
-
prepare
protected java.sql.PreparedStatement prepare(java.lang.String sqlStmt) throws java.sql.SQLExceptionCreate a prepared statement- Parameters:
sqlStmt- - SQL statement- Throws:
java.sql.SQLException
-
getPreparedStatement
protected EnginePreparedStatement getPreparedStatement() throws java.sql.SQLException
Get prepared statement- Returns:
- prepared statement
- Throws:
java.sql.SQLException
-
execute
protected boolean execute() throws java.sql.SQLExceptionExecutes the prepared statement and populates the resultSetTable. Access to the various resultSets is then possible by using setCurrentDrdaResultSet(String pkgnamcsn) to set the current resultSet and then calling getResultSet() or the other access methods to get resultset data.- Returns:
- true if the execution has resultSets
- Throws:
java.sql.SQLException
-
finishParams
protected void finishParams()
clear out type data for parameters. Unfortunately we currently overload the resultSet type info rsDRDATypes et al with parameter info. RESOLVE: Need to separate this
-
setPkgnamcsn
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. For dyamic packages The package name is encoded as follows SYS(S/L)(H/N)xyy where 'S' represents Small package and 'L' large (ignored by Derby) Where 'H' represents WITH HOLD, and 'N' represents NO WITH HOLD. (May be overridden by SQLATTR for WITH HOLD") Where 'www' is the package iteration (ignored by Derby) Where 'x' is the isolation level: 0=NC, 1=UR, 2=CS, 3=RS, 4=RR Where 'yy' is the package iteration 00 through FF Where 'zz' is unique for each platform Happilly, these values correspond precisely to the internal Derby isolation levels in ExecutionContext.java x Isolation Level -- --------------------- 0 NC (java.sql.Connection.TRANSACTION_NONE) 1 UR (java.sql.Connection.TRANACTION_READ_UNCOMMITTED) 2 CS (java.sql.Connection.TRANSACTION_READ_COMMITTED) 3 RS (java.sql.Connection.TRANSACTION_REPEATABLE_READ) 4 RR (java.sql.Connection.TRANSACTION_SERIALIZABLE) static packages have preset isolation levels (see getStaticPackageIsolation)- Parameters:
pkgnamcsn- package id section number and token from the client
-
getStaticPackageIsolation
private int getStaticPackageIsolation(java.lang.String pkgid)
get the isolation level for a static package.- Parameters:
pkgid- - Package identifier string (e.g. SYSSTAT)- Returns:
- isolation
-
getPkgnamcsn
protected Pkgnamcsn getPkgnamcsn()
Get pkgnamcsn- Returns:
- pkgnamcsn
-
getResultSet
protected java.sql.ResultSet getResultSet()
Get result set- Returns:
- result set
-
getCurrentDrdaResultSet
protected DRDAResultSet getCurrentDrdaResultSet()
Gets the current DRDA ResultSet- Returns:
- DRDAResultSet
-
setCurrentDrdaResultSet
protected void setCurrentDrdaResultSet(int rsNum)
Set currentDrdaResultSet- Parameters:
rsNum- The result set number starting with 0
-
setCurrentDrdaResultSet
protected void setCurrentDrdaResultSet(Pkgnamcsn pkgnamcsn)
Set currentDrdaResultSet- Parameters:
pkgnamcsn- The pkgid section number and unique resultset consistency token
-
getDrdaResultSet
private DRDAResultSet getDrdaResultSet(ConsistencyToken consistToken)
-
getDrdaResultSet
private DRDAResultSet getDrdaResultSet(int rsNum)
-
addResultSet
protected ConsistencyToken addResultSet(java.sql.ResultSet value, int holdValue) throws java.sql.SQLException
Add a new resultSet to this statement. Set as the current result set if there is not an existing current resultset.- Parameters:
value- - ResultSet to addholdValue- - Holdability of the ResultSet- Returns:
- Consistency token for this resultSet For a single resultSet that is the same as the statement's For multiple resultSets just the consistency token is changed
- Throws:
java.sql.SQLException
-
getNumResultSets
protected int getNumResultSets()
- Returns:
- number of result sets
-
getResultSetPkgcnstkn
protected ConsistencyToken getResultSetPkgcnstkn(int rsNum)
- Parameters:
rsNum- result set starting with 0- Returns:
- consistency token (key) for the result set
-
getRsDRDATypes
protected int[] getRsDRDATypes()
- Returns:
- ResultSet DRDA DataTypes
-
rsClose
protected void rsClose() throws java.sql.SQLExceptionClose the current resultSet- Throws:
java.sql.SQLException
-
CLSQRY
protected void CLSQRY()
Explicitly close the result set by CLSQRY needed to check for double close.
-
wasExplicitlyClosed
protected boolean wasExplicitlyClosed()
-
close
protected void close() throws java.sql.SQLExceptionThis method closes the JDBC objects and frees up all references held by this object.- Throws:
java.sql.SQLException
-
reset
protected void reset()
This method resets the state of this DRDAStatement object so that it can be re-used. This method should reset all variables of this class except the following: 1. database - This variable gets initialized in the constructor and by call to setDatabase. 2. members which get initialized in setPkgnamcsn (pkgnamcsn, pkgcnstkn, pkgid, pkgsn, isolationLevel, cursorName). pkgnamcsn is the key used to find if the DRDAStatement can be re-used. Hence its value will not change when the object is re-used.
-
rsIsClosed
protected boolean rsIsClosed()
is Statement closed- Returns:
- whether the statement is closed
-
rsSuspend
protected void rsSuspend()
Set state to SUSPENDED (result set is opened)
-
setRsPrecision
protected void setRsPrecision(int index, int precision)set resultset/out parameter precision- Parameters:
index- - starting with 1precision-
-
getRsPrecision
protected int getRsPrecision(int index)
get resultset /out parameter precision- Parameters:
index- -starting with 1- Returns:
- precision of column
-
setRsScale
protected void setRsScale(int index, int scale)set resultset/out parameter scale- Parameters:
index- - starting with 1scale-
-
getRsScale
protected int getRsScale(int index)
get resultset /out parameter scale- Parameters:
index- -starting with 1- Returns:
- scale of column
-
setRsDRDAType
protected void setRsDRDAType(int index, int type)set result DRDAType- Parameters:
index- - starting with 1type-
-
clearDrdaParams
protected void clearDrdaParams()
Clears the parameter state (type, length and ext information) stored in this statement, but does not release any storage. This reduces the cost of re-executing the statement since no new storage needs to be allocated.
-
getExtPositionCount
protected int getExtPositionCount()
Get the number of external parameters in this statement. External means parameters that are transmitted in a separate DSS in the DRDA protocol.- Returns:
- the number of external parameters
-
getExtPosition
protected int getExtPosition(int i)
Get the parameter position of the i'th external parameter- Parameters:
i- - zero-based index into list of external parameters- Returns:
- the parameter position of the i'th external parameter
-
addExtPosition
protected void addExtPosition(int pos)
Mark the pos'th parameter as external- Parameters:
pos- - zero-based index into list of external parameters
-
getDrdaParamCount
protected int getDrdaParamCount()
Get the number of parameters, internal and external, that has been added to this statement.- Returns:
- the number of parameters
-
addDrdaParam
protected void addDrdaParam(byte t, int l)Add another parameter to this statement.- Parameters:
t- - type of the parameterl- - length in bytes of the parameter
-
setStreamedParameter
protected void setStreamedParameter(EXTDTAReaderInputStream eis)
-
getParamDRDAType
protected int getParamDRDAType(int index)
get parameter DRDAType- Parameters:
index- - starting with 1- Returns:
- DRDA Type of column
-
getParamLen
protected int getParamLen(int index)
returns drda length of parameter as sent by client.- Parameters:
index- - starting with 1- Returns:
- data length
-
getParamPrecision
protected int getParamPrecision(int index) throws java.sql.SQLExceptionget parameter precision or DB2 max (31)- Parameters:
index- parameter index starting with 1- Returns:
- precision
- Throws:
java.sql.SQLException
-
getParamScale
protected int getParamScale(int index) throws java.sql.SQLExceptionget parameter scale or DB2 max (31)- Parameters:
index- parameter index starting with 1- Returns:
- scale
- Throws:
java.sql.SQLException
-
getNumRsCols
protected int getNumRsCols()
get the number of result set columns for the current resultSet- Returns:
- number of columns
-
getRsDRDAType
protected int getRsDRDAType(int index)
get resultset/out parameter DRDAType- Parameters:
index- - starting with 1- Returns:
- DRDA Type of column
-
getRsLen
protected int getRsLen(int index)
get resultset/out parameter DRDALen- Parameters:
index- starting with 1- Returns:
- length of drda data
-
getResultSetCursorName
public java.lang.String getResultSetCursorName(int rsNum) throws java.sql.SQLException- Parameters:
rsNum- - result set # starting with 0- Throws:
java.sql.SQLException
-
toDebugString
protected java.lang.String toDebugString(java.lang.String indent)
-
calculateResultSetPkgcnstkn
protected ConsistencyToken calculateResultSetPkgcnstkn(int rsNum)
For a single result set, just echo the consistency token that the client sent us. For subsequent resultSets, just subtract the resultset number from the consistency token and that will differentiate the result sets. This seems to be what DB2 does- Parameters:
rsNum- - result set # starting with 0- Returns:
- Consistency token for result set
-
isCallableStatement
protected boolean isCallableStatement()
-
isCallableSQL
private boolean isCallableSQL(java.lang.String sql)
-
setupCallableStatementParams
private void setupCallableStatementParams(java.sql.CallableStatement cs) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getOutputParameterTypeFromClassName
protected static int getOutputParameterTypeFromClassName(java.lang.String objectName)
Given an object class name get the paramameter type if the parameter mode is unknown. Arrays except for byte arrrays are assumed to be output parameters TINYINT output parameters are going to be broken because there is no way to differentiate them from binary input parameters.- Parameters:
objectName- Class name of object being evaluated. indicating if this an output parameter- Returns:
- type from java.sql.Types
-
registerAllOutParams
public void registerAllOutParams() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
registerOutParam
public void registerOutParam(int paramNum) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
hasOutputParams
protected boolean hasOutputParams()
-
isOutputParam
boolean isOutputParam(int paramNum)
is parameter an ouput parameter- Parameters:
paramNum- parameter number starting with 1. return true if this is an output parameter.
-
getOutputParamType
int getOutputParamType(int paramNum)
get type for output parameter.- Parameters:
paramNum- - parameter number starting with 1- Returns:
- jdbcType or NOT_OUTPUT_PARAM if this is not an output parameter
-
getOutputParamScale
int getOutputParamScale(int paramNum)
get scale for output parameter.- Parameters:
paramNum- - parameter number starting with 1- Returns:
- scale or NOT_OUTPUT_PARAM if this is not an output parameter
-
getOutputParamPrecision
int getOutputParamPrecision(int paramNum)
get precision for output parameter.- Parameters:
paramNum- - parameter number starting with 1- Returns:
- precision or NOT_OUTPUT_PARAM if this is not an output parameter
-
isDynamicPkgid
private boolean isDynamicPkgid(java.lang.String pkgid)
-
parsePkgidToFindHoldability
private void parsePkgidToFindHoldability()
-
getParameterMetaData
protected java.sql.ParameterMetaData getParameterMetaData() throws java.sql.SQLExceptionRetrieve the ParameterMetaData for the prepared statement.- Returns:
- ParameterMetaData for the prepared statement. Note: there is no separate BrokeredParameterSetMetaData.
- Throws:
java.sql.SQLException
-
getMoreResults
private boolean getMoreResults(int current) throws java.sql.SQLExceptionget more results using reflection.- Parameters:
current- - flag to pass to Statement.getMoreResults(current)- Returns:
- true if there are more results.
- Throws:
java.sql.SQLException- See Also:
Statement.getMoreResults()
-
getSQLText
private java.lang.String getSQLText()
Use reflection to retrieve SQL Text for EmbedPreparedStatement or BrokeredPreparedStatement.- Returns:
- SQL text
-
isRSCloseImplicit
boolean isRSCloseImplicit(boolean lmtblkprcOK) throws java.sql.SQLExceptionMethod to decide whether the ResultSet should be closed implicitly based on the QRYCLSIMP value sent from the client. Only forward-only result sets should be implicitly closed. Some clients do not expect result sets to be closed implicitly if the protocol is LMTBLKPRC.- Parameters:
lmtblkprcOK-trueif the client expects QRYCLSIMP to be respected for the LMTBLKPRC protocol- Returns:
- implicit close boolean
- Throws:
java.sql.SQLException
-
-