org.apache.derby.impl.drda
Class DRDAStatement

java.lang.Object
  extended by org.apache.derby.impl.drda.DRDAStatement

 class DRDAStatement
extends java.lang.Object

DRDAStatement stores information about the statement being executed


Nested Class Summary
private static class DRDAStatement.DrdaParamState
          This class is used to keep track of the statement's parameters as they are received from the client.
 
Field Summary
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
           
protected  ConsistencyToken pkgcnstkn
           
protected  java.lang.String pkgid
           
private  Pkgnamcsn pkgnamcsn
           
protected  int pkgsn
           
protected  java.lang.String procName
           
protected  java.sql.PreparedStatement ps
           
private  int qryprctyp
           
protected  boolean qryrfrtbl
           
protected  int qryrowset
           
private  java.util.ArrayList resultSetKeyList
           
private  java.util.Hashtable resultSetTable
           
protected  long rowCount
           
protected  byte[] rslsetflg
           
protected  int scrollType
           
private  java.sql.Statement stmt
           
protected  java.sql.ParameterMetaData stmtPmeta
           
protected  java.lang.String typDefNam
           
(package private)  int withHoldCursor
           
 
Constructor Summary
DRDAStatement(Database database)
          DRDAStatement constructor
 
Method Summary
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  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 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 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  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
 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 paramter precision
protected  int getRsScale(int index)
          get resultset /out paramter scale
protected  int getScrollType()
           
 byte[] getSplitQRYDTA()
           
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.
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 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)
          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()
           
 
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 Pkgnamcsn pkgnamcsn

pkgcnstkn

protected ConsistencyToken pkgcnstkn

pkgid

protected java.lang.String pkgid

pkgsn

protected int pkgsn

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 java.sql.PreparedStatement 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 java.sql.Statement stmt

currentDrdaRs

private DRDAResultSet currentDrdaRs

resultSetTable

private java.util.Hashtable resultSetTable

resultSetKeyList

private java.util.ArrayList resultSetKeyList

numResultSets

private int numResultSets

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
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.SQLException
Set statement

Parameters:
conn - Connection
Throws:
java.sql.SQLException

getStatement

protected java.sql.Statement getStatement()
                                   throws java.sql.SQLException
Get the statement

Returns:
statement
Throws:
java.sql.SQLException

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 getExtDtaObjects()
Get the extData Objects

Returns:
ArrayList with extdta

setExtDtaObjects

protected void setExtDtaObjects(java.util.ArrayList a)
Set the extData Objects


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 add
jdbcIndex - - 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 current DRDAResultSet object.

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 initiliazed differently. e.g: stmt variable used in default statement is created only once in Database.makeConnection. TODO: Need to see what exactly it means to initialize the default statement. (DERBY-1002)


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.SQLException
Create a prepared statement

Parameters:
sqlStmt - - SQL statement
Throws:
java.sql.SQLException

getPreparedStatement

protected java.sql.PreparedStatement getPreparedStatement()
                                                   throws java.sql.SQLException
Get prepared statement

Returns:
prepared statement
Throws:
java.sql.SQLException

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.

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 add
holdValue - - 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.SQLException
Close 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.SQLException
This 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 1
precision -

getRsPrecision

protected int getRsPrecision(int index)
get resultset /out paramter 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 1
scale -

getRsScale

protected int getRsScale(int index)
get resultset /out paramter 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 1
type -

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 parameter
l - - 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.SQLException
get 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.SQLException
get 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.SQLException
Retrieve 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.SQLException
get 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.SQLException
Method 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 - true if the client expects QRYCLSIMP to be respected for the LMTBLKPRC protocol
Returns:
implicit close boolean
Throws:
java.sql.SQLException

Built on Thu 2010-12-23 20:49:13+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.