Package org.apache.derby.impl.drda
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 int
private int[]
private EXTDTAReaderInputStream
private byte[]
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addDrdaParam
(byte t, int s) addDrdaParam
adds a new parameter with its DRDA type and byte length.protected void
addExtPos
(int p) addExtPos
marks parameter i as external.protected void
clear
(boolean trim) clear
resets the arrays so that new parameters will be added at the beginning.protected void
Read the rest of the streamed parameter if not consumed by the executing statement.protected int
getDrdaLen
(int i) getDrdaLen
returns the length in bytes of the ith parameter.protected int
getDrdaParamCount
return the number of parameters added so far (since last clear).protected byte
getDrdaType
(int i) getDrdaType
returns a byte that represents the DRDA type of the ith parameter.protected int
getExtPos
(int i) getExtPos
returns the actual parameter position of the ith external parameter.protected int
getExtPosCount
returns the number of parameters marked as external so far (since last clear).private static Object
void
-
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) clear
resets 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) addDrdaParam
adds a new parameter with its DRDA type and byte length. The arrays are automatically grown if needed.- Parameters:
t
- abyte
value, the DRDA type of the parameter being addeds
- anint
value, the length in bytes of the parameter being added
-
getDrdaParamCount
protected int getDrdaParamCount()getDrdaParamCount
return the number of parameters added so far (since last clear).- Returns:
- an
int
value, the number of parameters
-
getDrdaType
protected byte getDrdaType(int i) getDrdaType
returns a byte that represents the DRDA type of the ith parameter.- Parameters:
i
- anint
value, a parameter position (zero-based)- Returns:
- a
byte
value, the DRDA type
-
getDrdaLen
protected int getDrdaLen(int i) getDrdaLen
returns the length in bytes of the ith parameter.- Parameters:
i
- anint
value, a parameter position (zero-based)- Returns:
- an
int
value
-
addExtPos
protected void addExtPos(int p) addExtPos
marks parameter i as external. The array is grown as needed.- Parameters:
p
- anint
value, a parameter position (zero-based)
-
getExtPosCount
protected int getExtPosCount()getExtPosCount
returns the number of parameters marked as external so far (since last clear).- Returns:
- an
int
value, the number of external parameters.
-
getExtPos
protected int getExtPos(int i) getExtPos
returns the actual parameter position of the ith external parameter.- Parameters:
i
- anint
value, index into the list of external parameters, zero-based- Returns:
- an
int
value, 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
-