Package net.sourceforge.jtds.jdbc
Class ParamInfo
java.lang.Object
net.sourceforge.jtds.jdbc.ParamInfo
- All Implemented Interfaces:
Cloneable
This class is a descriptor for procedure and prepared statement parameters.
- Version:
- $Id: ParamInfo.java,v 1.16 2005-04-25 11:47:01 alin_sinpalean Exp $
- Author:
- Mike Hutchinson
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) CharsetInfoCharacter set descriptor (if different from default)(package private) byte[]TDS 8 Collation string.(package private) static final intFlag as an input parameter.(package private) booleanParameter is an output parameter(package private) booleanParameter is used as SP return value(package private) booleanIN parameter has been set(package private) booleanOUT parameter value is set.(package private) booleanParameter should be sent as unicode(package private) intJDBC type constant from java.sql.Types(package private) intLength of InputStream(package private) intParameter offset in target SQL statement(package private) StringFormal parameter name eg @P1(package private) static final intFlag as an output parameter.(package private) ObjectOUT Parameter value.(package private) intParameter decimal precision(package private) static final intFlag as an return value parameter.(package private) intParameter decimal scale(package private) StringSQL type name eg varchar(10)(package private) intInternal TDS data type(package private) static final intFlag as a unicode parameter.(package private) ObjectCurrent parameter value -
Constructor Summary
ConstructorsConstructorDescriptionParamInfo(int pos, boolean isUnicode) Construct a parameter with parameter marker offset.Construct an initialised parameter with extra attributes.Construct a parameter for statement caching.Construct a parameter based on a result set column. -
Method Summary
Modifier and TypeMethodDescription(package private) voidClear the IN parameter value and status.(package private) voidClear the OUT parameter value and status.clone()Creates a shallow copy of thisParamInfoinstance.(package private) byte[]Get the byte array value of the parameter.(package private) ObjectGet the output parameter value.(package private) StringGet the string value of the parameter.private static StringloadFromReader(Reader in, int length) Create a String from a Reader stream.private static byte[]loadFromStream(InputStream in, int length) Load a byte array from an InputStream(package private) voidsetOutValue(Object value) Set the OUT parameter value.
-
Field Details
-
INPUT
static final int INPUTFlag as an input parameter.- See Also:
-
OUTPUT
static final int OUTPUTFlag as an output parameter.- See Also:
-
RETVAL
static final int RETVALFlag as an return value parameter.- See Also:
-
UNICODE
static final int UNICODEFlag as a unicode parameter.- See Also:
-
tdsType
int tdsTypeInternal TDS data type -
jdbcType
int jdbcTypeJDBC type constant from java.sql.Types -
name
String nameFormal parameter name eg @P1 -
sqlType
String sqlTypeSQL type name eg varchar(10) -
markerPos
int markerPosParameter offset in target SQL statement -
value
Object valueCurrent parameter value -
precision
int precisionParameter decimal precision -
scale
int scaleParameter decimal scale -
length
int lengthLength of InputStream -
isOutput
boolean isOutputParameter is an output parameter -
isRetVal
boolean isRetValParameter is used as SP return value -
isSet
boolean isSetIN parameter has been set -
isUnicode
boolean isUnicodeParameter should be sent as unicode -
collation
byte[] collationTDS 8 Collation string. -
charsetInfo
CharsetInfo charsetInfoCharacter set descriptor (if different from default) -
isSetOut
boolean isSetOutOUT parameter value is set. -
outValue
Object outValueOUT Parameter value.
-
-
Constructor Details
-
ParamInfo
ParamInfo(int pos, boolean isUnicode) Construct a parameter with parameter marker offset.- Parameters:
pos- the offset of the ? symbol in the target SQL stringisUnicode-trueif the parameter is Unicode encoded
-
ParamInfo
ParamInfo(String name, int pos, boolean isRetVal, boolean isUnicode) Construct a parameter for statement caching.- Parameters:
name- the formal name of the parameterpos- the offset of the ? symbol in the parsed SQL stringisRetVal-trueif the parameter is a return valueisUnicode-trueif the parameter is Unicode encoded
-
ParamInfo
ParamInfo(int jdbcType, Object value, int flags) Construct an initialised parameter with extra attributes.- Parameters:
jdbcType- thejava.sql.Typeconstant describing this typevalue- the initial parameter valueflags- the additional attributes eg OUTPUT, RETVAL, UNICODE etc.
-
ParamInfo
Construct a parameter based on a result set column.- Parameters:
ci- the column descriptorname- the name for this parameter or nullvalue- the column data valuelength- the column data length
-
-
Method Details
-
getOutValue
Get the output parameter value.- Returns:
- the OUT value as an
Object - Throws:
SQLException- if the parameter has not been set
-
setOutValue
Set the OUT parameter value.- Parameters:
value- The data value.
-
clearOutValue
void clearOutValue()Clear the OUT parameter value and status. -
clearInValue
void clearInValue()Clear the IN parameter value and status. -
getString
Get the string value of the parameter.- Returns:
- The data value as a
Stringor null. - Throws:
IOException
-
getBytes
Get the byte array value of the parameter.- Returns:
- The data value as a
byte[]or null. - Throws:
IOException
-
loadFromStream
Load a byte array from an InputStream- Parameters:
in- The InputStream to read from.length- The length of the stream.- Returns:
- The data as a
byte[]. - Throws:
IOException
-
loadFromReader
Create a String from a Reader stream.- Parameters:
in- The Reader object with the data.length- Number of characters to read.- Returns:
- The data as a
String. - Throws:
IOException
-
clone
Creates a shallow copy of thisParamInfoinstance. Used by thePreparedStatementbatching implementation to duplicate parameters.
-