|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> [ drda overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.impl.drda
Class DRDAStatement

java.lang.Objectorg.apache.derby.impl.drda.DRDAStatement
- class DRDAStatement
- extends java.lang.Object
DRDAStatement stores information about the statement being executed
| Constructor Summary | |
protected |
DRDAStatement(Database database)
DRDAStatement constructor |
| Method Summary | |
protected void |
addExtDtaObject(java.lang.Object o,
int jdbcIndex)
Add extDtaObject |
protected java.lang.String |
addResultSet(java.sql.ResultSet value)
Add a new resultSet to this statement. |
protected java.lang.String |
calculateResultSetPkgcnstknStr(int rsNum)
For a single result set, just echo the consistency token that the client sent us. |
protected void |
clearExtDtaObjects()
Clear externalized lob objects in current result set |
protected void |
close()
Clean up statements and resultSet |
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)
|
private java.lang.String |
extractPkgcnstknStr(java.lang.String pkgnamcsn)
|
protected void |
finishParams()
clear out type data for parameters. |
protected int |
getBlksize()
|
protected int |
getConcurType()
|
private DRDAResultSet |
getDrdaResultSet(int rsNum)
|
private DRDAResultSet |
getDrdaResultSet(java.lang.String consistToken)
|
protected java.util.ArrayList |
getExtDtaObjects()
Get the extData Objects |
protected boolean |
getMoreResults(int current)
get more results using reflection. |
protected int |
getNumParams()
get the number of parameters for this statement |
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 |
getOutputParamType(int paramNum)
get type for output parameter. |
protected int |
getParamDRDAType(int index)
get parameter DRDAType |
protected org.apache.derby.impl.jdbc.EmbedParameterSetMetaData |
getParameterMetaData()
Get parameter metadata from EmbedPreparedStatement or BrokeredPreparedStatement. |
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 java.lang.String |
getPkgnamcsn()
Get pkgnamcsn |
protected java.sql.PreparedStatement |
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 |
private java.sql.ResultSet |
getResultSet(int rsNum)
Just get the resultset. |
java.lang.String |
getResultSetCursorName(int rsNum)
|
protected int |
getResultSetHoldability()
get resultSetHoldability with reflection. |
protected java.lang.String |
getResultSetPkgcnstknStr(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[] |
getRsLens()
|
protected int |
getRsPrecision(int index)
get resultset /out paramter precision |
protected int |
getRsScale(int index)
get resultset /out paramter scale |
protected int |
getScrollType()
|
private java.lang.String |
getSQLText()
Use reflection to retrieve SQL Text for EmbedPreparedStatement or BrokeredPreparedStatement. |
protected java.sql.Statement |
getStatement()
Get the statement |
private int |
getStaticPackageIsolation(java.lang.String pkgid)
get the isolation level for a static package. |
private void |
handleReflectionException(java.lang.Exception e)
helper method to handle exceptions generated by methods invoked through reflection. |
protected boolean |
hasdata()
|
protected boolean |
hasOutputParams()
|
protected void |
initialize()
Initialize for reuse |
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 |
boolean |
isProcedure()
return whether this is a procedure |
(package private) boolean |
isRSCloseImplicit()
Delegation method to call DRDAResultSet.isRSCloseImplicit() |
protected boolean |
isScrollable()
is this a scrollable cursor? return true if this is not a forward only cursor |
private void |
parsePkgidToFindHoldability()
|
protected java.sql.PreparedStatement |
prepare(java.lang.String sqlStmt)
Create a prepared statement |
private java.sql.PreparedStatement |
prepareStatementJDBC3(java.lang.String sqlStmt,
int scrollType,
int concurType,
int withHoldCursor)
prepare a statement using reflection so that server can run on jdk131 and still pass holdability. |
void |
registerAllOutParams()
|
void |
registerOutParam(int paramNum)
|
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(java.lang.String pkgnamcsn)
Set currentDrdaResultSet |
protected void |
setDatabase(Database database)
Set database |
protected void |
setExtDtaObjects(java.util.ArrayList a)
Set the extData Objects |
protected void |
setHasdata(boolean hasdata)
|
protected void |
setOPNQRYOptions(int blksize,
int qryblkctl,
int maxblkext,
int outovropt,
int qryrowset,
int qryclsimpl)
Delegation method to call DRDAResultSet to set query options sent on OPNQRY. |
protected void |
setOutovr_drdaType(int[] outovr_drdaType)
|
protected void |
setParamDRDAType(int index,
byte type)
set param DRDAType |
protected void |
setParamLen(int index,
int value)
save parameter len sent by client |
protected void |
setPkgnamcsn(java.lang.String 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 |
setResultSet(java.sql.ResultSet value)
Set result set |
protected void |
setRsDefaultOptions()
Set result set options to default for statement |
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 |
setRsDRDATypes(int[] value)
Set ResultSet DRDA DataTypes |
protected void |
setRsLen(int index,
int value)
set resultset column data length |
protected void |
setRsLens(int[] value)
Set ResultSet DRDA DataTypes Lengths |
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)
|
protected void |
setStatement(java.sql.Connection conn)
Set statement |
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()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 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 java.lang.String pkgnamcsn
pkgcnstknStr
protected java.lang.String pkgcnstknStr
pkgid
protected java.lang.String pkgid
sectionNumber
protected java.lang.String sectionNumber
withHoldCursor
protected 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 java.sql.PreparedStatement ps
stmtPmeta
protected org.apache.derby.impl.jdbc.EmbedParameterSetMetaData stmtPmeta
isCall
protected boolean isCall
procName
protected java.lang.String procName
outputTypes
private int[] outputTypes
NOT_OUTPUT_PARAM
protected static int NOT_OUTPUT_PARAM
outputExpected
protected boolean outputExpected
stmt
private java.sql.Statement stmt
currentDrdaRs
private DRDAResultSet currentDrdaRs
resultSetTable
private java.util.Hashtable resultSetTable
resultSetKeyList
private java.util.ArrayList resultSetKeyList
numResultSets
private int numResultSets
cliParamDrdaTypes
protected java.util.Vector cliParamDrdaTypes
cliParamLens
protected java.util.Vector cliParamLens
cliParamExtPositions
protected java.util.ArrayList cliParamExtPositions
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
| Constructor Detail |
DRDAStatement
protected DRDAStatement(Database database)
- DRDAStatement constructor
| Method Detail |
setTypDefValues
protected void setTypDefValues()
- set TypDef values
setDatabase
protected void setDatabase(Database database)
- Set database
setStatement
protected void setStatement(java.sql.Connection conn) throws java.sql.SQLException
- Set statement
getStatement
protected java.sql.Statement getStatement() throws java.sql.SQLException
- Get the 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
setRsDefaultOptions
protected void setRsDefaultOptions()
- Set result set options to default for statement
getExtDtaObjects
protected java.util.ArrayList getExtDtaObjects()
- Get the extData Objects
setExtDtaObjects
protected void setExtDtaObjects(java.util.ArrayList a)
- Set the extData Objects
addExtDtaObject
protected void addExtDtaObject(java.lang.Object o, int jdbcIndex)
- Add extDtaObject
clearExtDtaObjects
protected void clearExtDtaObjects()
- Clear externalized lob objects in current result set
getResultSetHoldability
protected int getResultSetHoldability()
throws java.sql.SQLException
- get resultSetHoldability with reflection.
We need to use reflection so we can use hold cursors with 1.3.1.
And also since our statement might be a BrokeredStatement.
isExtDtaValueNullable
protected boolean isExtDtaValueNullable(int index)
setOPNQRYOptions
protected void setOPNQRYOptions(int blksize,
int qryblkctl,
int maxblkext,
int outovropt,
int qryrowset,
int qryclsimpl)
- Delegation method to call DRDAResultSet to set query
options sent on OPNQRY.
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
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()
- Initialize for reuse
explicitPrepare
protected java.sql.PreparedStatement explicitPrepare(java.lang.String sqlStmt) throws java.sql.SQLException
wasExplicitlyPrepared
protected boolean wasExplicitlyPrepared()
prepare
protected java.sql.PreparedStatement prepare(java.lang.String sqlStmt) throws java.sql.SQLException
- Create a prepared statement
getPreparedStatement
protected java.sql.PreparedStatement getPreparedStatement() throws java.sql.SQLException
- Get prepared statement
execute
protected boolean execute()
throws java.sql.SQLException
- Executes 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.
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(java.lang.String 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 cloudscape)
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 cloudcape)
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 cloudscape
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)
getStaticPackageIsolation
private int getStaticPackageIsolation(java.lang.String pkgid)
- get the isolation level for a static package.
getPkgnamcsn
protected java.lang.String getPkgnamcsn()
- Get pkgnamcsn
getResultSet
protected java.sql.ResultSet getResultSet()
- Get result set
getResultSet
private java.sql.ResultSet getResultSet(int rsNum)
- Just get the resultset. Don't set it to current
Assumes resultSet rsnum exists.
setResultSet
protected void setResultSet(java.sql.ResultSet value) throws java.sql.SQLException
- Set result set
setCurrentDrdaResultSet
protected void setCurrentDrdaResultSet(int rsNum)
- Set currentDrdaResultSet
setCurrentDrdaResultSet
protected void setCurrentDrdaResultSet(java.lang.String pkgnamcsn)
- Set currentDrdaResultSet
getDrdaResultSet
private DRDAResultSet getDrdaResultSet(java.lang.String consistToken)
getDrdaResultSet
private DRDAResultSet getDrdaResultSet(int rsNum)
extractPkgcnstknStr
private java.lang.String extractPkgcnstknStr(java.lang.String pkgnamcsn)
addResultSet
protected java.lang.String addResultSet(java.sql.ResultSet value) 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.
getNumResultSets
protected int getNumResultSets()
getResultSetPkgcnstknStr
protected java.lang.String getResultSetPkgcnstknStr(int rsNum)
setRsDRDATypes
protected void setRsDRDATypes(int[] value)
- Set ResultSet DRDA DataTypes
getRsDRDATypes
protected int[] getRsDRDATypes()
setRsLens
protected void setRsLens(int[] value)
- Set ResultSet DRDA DataTypes Lengths
getRsLens
protected int[] getRsLens()
rsClose
protected void rsClose()
throws java.sql.SQLException
- Close the current resultSet
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.SQLException
- Clean up statements and resultSet
rsIsClosed
protected boolean rsIsClosed()
- is Statement 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
getRsPrecision
protected int getRsPrecision(int index)
- get resultset /out paramter precision
setRsScale
protected void setRsScale(int index,
int scale)
- set resultset/out parameter scale
getRsScale
protected int getRsScale(int index)
- get resultset /out paramter scale
setRsDRDAType
protected void setRsDRDAType(int index,
int type)
- set result DRDAType
getParamDRDAType
protected int getParamDRDAType(int index)
- get parameter DRDAType
setParamDRDAType
protected void setParamDRDAType(int index,
byte type)
- set param DRDAType
getParamLen
protected int getParamLen(int index)
- returns drda length of parameter as sent by client.
getParamPrecision
protected int getParamPrecision(int index)
throws java.sql.SQLException
- get parameter precision or DB2 max (31)
getParamScale
protected int getParamScale(int index)
throws java.sql.SQLException
- get parameter scale or DB2 max (31)
setParamLen
protected void setParamLen(int index,
int value)
- save parameter len sent by client
getNumParams
protected int getNumParams()
- get the number of parameters for this statement
getNumRsCols
protected int getNumRsCols()
- get the number of result set columns for the current resultSet
getRsDRDAType
protected int getRsDRDAType(int index)
- get resultset/out parameter DRDAType
getRsLen
protected int getRsLen(int index)
- get resultset/out parameter DRDALen
setRsLen
protected void setRsLen(int index,
int value)
- set resultset column data length
isProcedure
public boolean isProcedure()
- return whether this is a procedure
getResultSetCursorName
public java.lang.String getResultSetCursorName(int rsNum) throws java.sql.SQLException
toDebugString
protected java.lang.String toDebugString(java.lang.String indent)
calculateResultSetPkgcnstknStr
protected java.lang.String calculateResultSetPkgcnstknStr(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
isCallableStatement
protected boolean isCallableStatement()
isCallableSQL
private boolean isCallableSQL(java.lang.String sql)
setupCallableStatementParams
private void setupCallableStatementParams(java.sql.CallableStatement cs) 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.
registerAllOutParams
public void registerAllOutParams()
throws java.sql.SQLException
registerOutParam
public void registerOutParam(int paramNum)
throws java.sql.SQLException
hasOutputParams
protected boolean hasOutputParams()
isOutputParam
boolean isOutputParam(int paramNum)
- is parameter an ouput parameter
getOutputParamType
int getOutputParamType(int paramNum)
- get type for output parameter.
isDynamicPkgid
private boolean isDynamicPkgid(java.lang.String pkgid)
parsePkgidToFindHoldability
private void parsePkgidToFindHoldability()
prepareStatementJDBC3
private java.sql.PreparedStatement prepareStatementJDBC3(java.lang.String sqlStmt, int scrollType, int concurType, int withHoldCursor) throws java.sql.SQLException
- prepare a statement using reflection so that server can run on jdk131
and still pass holdability.
parameters are passed on to either the EmbedConnection or
BrokeredConnection prepareStatement() method.
getParameterMetaData
protected org.apache.derby.impl.jdbc.EmbedParameterSetMetaData getParameterMetaData() throws java.sql.SQLException
- Get parameter metadata from EmbedPreparedStatement or
BrokeredPreparedStatement. We use reflection because we don't know which
we have.
getMoreResults
protected boolean getMoreResults(int current)
throws java.sql.SQLException
- get more results using reflection.
getSQLText
private java.lang.String getSQLText()
- Use reflection to retrieve SQL Text for EmbedPreparedStatement
or BrokeredPreparedStatement.
handleReflectionException
private void handleReflectionException(java.lang.Exception e) throws java.sql.SQLException
- helper method to handle exceptions generated by methods invoked
through reflection.
isRSCloseImplicit
boolean isRSCloseImplicit()
throws java.sql.SQLException
- Delegation method to call DRDAResultSet.isRSCloseImplicit()
|
|||||||||
| Home >> All >> org >> apache >> derby >> impl >> [ drda overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.derby.impl.drda.DRDAStatement