Class DRDAStatement.DrdaParamState
java.lang.Object
org.apache.derby.impl.drda.DRDAStatement.DrdaParamState
- Enclosing class:
DRDAStatement
This class is used to keep track of the statement's parameters
as they are received from the client. It uses arrays to track
the DRDA type, the length in bytes and the externalness of each
parameter. Arrays of int/byte are used rather than ArrayLists
of Integer/Byte in order to re-use the same storage each time
the statement is executed.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]private intprivate int[]private EXTDTAReaderInputStreamprivate byte[]private int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDrdaParam(byte t, int s) addDrdaParamadds a new parameter with its DRDA type and byte length.protected voidaddExtPos(int p) addExtPosmarks parameter i as external.protected voidclear(boolean trim) clearresets the arrays so that new parameters will be added at the beginning.protected voidRead the rest of the streamed parameter if not consumed by the executing statement.protected intgetDrdaLen(int i) getDrdaLenreturns the length in bytes of the ith parameter.protected intgetDrdaParamCountreturn the number of parameters added so far (since last clear).protected bytegetDrdaType(int i) getDrdaTypereturns a byte that represents the DRDA type of the ith parameter.protected intgetExtPos(int i) getExtPosreturns the actual parameter position of the ith external parameter.protected intgetExtPosCountreturns the number of parameters marked as external so far (since last clear).private static Objectvoid
-
Field Details
-
streamedParameter
-
typeLstEnd_
private int typeLstEnd_ -
typeLst_
private byte[] typeLst_ -
lenLst_
private int[] lenLst_ -
extLstEnd_
private int extLstEnd_ -
extLst_
private int[] extLst_
-
-
Constructor Details
-
DrdaParamState
private DrdaParamState()
-
-
Method Details
-
growArray
-
clear
protected void clear(boolean trim) clearresets the arrays so that new parameters will be added at the beginning. No initialization or releasing of storage takes place unless the trim argument is true.- Parameters:
trim- - if true; release excess storage
-
addDrdaParam
protected void addDrdaParam(byte t, int s) addDrdaParamadds a new parameter with its DRDA type and byte length. The arrays are automatically grown if needed.- Parameters:
t- abytevalue, the DRDA type of the parameter being addeds- anintvalue, the length in bytes of the parameter being added
-
getDrdaParamCount
protected int getDrdaParamCount()getDrdaParamCountreturn the number of parameters added so far (since last clear).- Returns:
- an
intvalue, the number of parameters
-
getDrdaType
protected byte getDrdaType(int i) getDrdaTypereturns a byte that represents the DRDA type of the ith parameter.- Parameters:
i- anintvalue, a parameter position (zero-based)- Returns:
- a
bytevalue, the DRDA type
-
getDrdaLen
protected int getDrdaLen(int i) getDrdaLenreturns the length in bytes of the ith parameter.- Parameters:
i- anintvalue, a parameter position (zero-based)- Returns:
- an
intvalue
-
addExtPos
protected void addExtPos(int p) addExtPosmarks parameter i as external. The array is grown as needed.- Parameters:
p- anintvalue, a parameter position (zero-based)
-
getExtPosCount
protected int getExtPosCount()getExtPosCountreturns the number of parameters marked as external so far (since last clear).- Returns:
- an
intvalue, the number of external parameters.
-
getExtPos
protected int getExtPos(int i) getExtPosreturns the actual parameter position of the ith external parameter.- Parameters:
i- anintvalue, index into the list of external parameters, zero-based- Returns:
- an
intvalue, the parameter position of the ith external parameter (zero-based)
-
drainStreamedParameter
Read the rest of the streamed parameter if not consumed by the executing statement. DERBY-3085- Throws:
IOException
-
setStreamedParameter
-