class SimpleParameterList extends java.lang.Object implements V3ParameterList
Modifier and Type | Field and Description |
---|---|
private static byte |
BINARY |
private byte[][] |
encoded |
private byte[] |
flags |
private static byte |
IN |
private static byte |
INOUT |
private static java.lang.Object |
NULL_OBJECT
Marker object representing NULL; this distinguishes "parameter never set" from "parameter set
to null".
|
private static byte |
OUT |
private int[] |
paramTypes |
private java.lang.Object[] |
paramValues |
private int |
pos |
private static byte |
TEXT |
private TypeTransferModeRegistry |
transferModeRegistry |
Constructor and Description |
---|
SimpleParameterList(int paramCount,
TypeTransferModeRegistry transferModeRegistry) |
Modifier and Type | Method and Description |
---|---|
void |
appendAll(ParameterList list)
Use this operation to append more parameters to the current list.
|
private void |
bind(int index,
java.lang.Object value,
int oid,
byte binary) |
void |
checkAllParametersSet()
Ensure that all parameters in this list have been assigned values.
|
void |
clear()
Unbind all parameter values bound in this list.
|
void |
convertFunctionOutParameters()
Convert any function output parameters to the correct type (void) and set an ignorable value
for it.
|
ParameterList |
copy()
Perform a shallow copy of this ParameterList, returning a new instance (still suitable for
passing to the owning Query).
|
private byte |
direction(int index) |
byte[][] |
getEncoding()
Return the encoding for each parameter.
|
byte[] |
getFlags()
Return the flags for each parameter.
|
int |
getInParameterCount()
Get the number of IN parameters in this list.
|
int |
getOutParameterCount()
Get the number of OUT parameters in this list.
|
int |
getParameterCount()
Get the number of parameters in this list.
|
int[] |
getParamTypes()
Return the parameter type information.
|
SimpleParameterList[] |
getSubparams()
Return a list of the SimpleParameterList objects that make up this parameter list.
|
(package private) int |
getTypeOID(int index) |
int[] |
getTypeOIDs()
Return the oids of the parameters in this list.
|
(package private) int |
getV3Length(int index) |
java.lang.Object[] |
getValues()
Returns the bound parameter values.
|
(package private) boolean |
hasUnresolvedTypes() |
(package private) boolean |
isBinary(int index) |
(package private) boolean |
isNull(int index) |
void |
registerOutParameter(int index,
int sqlType) |
void |
setBinaryParameter(int index,
byte[] value,
int oid)
Binds given byte[] value to a parameter.
|
void |
setBytea(int index,
byte[] data,
int offset,
int length)
Binds a binary bytea value stored as a bytearray to a parameter.
|
void |
setBytea(int index,
ByteStreamWriter writer)
Binds a binary bytea value stored as a ByteStreamWriter.
|
void |
setBytea(int index,
java.io.InputStream stream)
Binds a binary bytea value stored as an InputStream.
|
void |
setBytea(int index,
java.io.InputStream stream,
int length)
Binds a binary bytea value stored as an InputStream.
|
void |
setIntParameter(int index,
int value)
Binds an integer value to a parameter.
|
void |
setLiteralParameter(int index,
java.lang.String value,
int oid)
Binds a String value that is an unquoted literal to the server's query parser (for example, a
bare integer) to a parameter.
|
void |
setNull(int index,
int oid)
Binds a SQL NULL value to a parameter.
|
(package private) void |
setResolvedType(int index,
int oid) |
void |
setStringParameter(int index,
java.lang.String value,
int oid)
Binds a String value that needs to be quoted for the server's parser to understand (for
example, a timestamp) to a parameter.
|
void |
setText(int index,
java.io.InputStream stream)
Binds a text value stored as an InputStream that is a valid UTF-8 byte stream.
|
private static void |
streamBytea(PGStream pgStream,
ByteStreamWriter writer) |
private static void |
streamBytea(PGStream pgStream,
StreamWrapper wrapper) |
java.lang.String |
toString()
Useful implementation of toString.
|
java.lang.String |
toString(int index,
boolean standardConformingStrings)
Return a human-readable representation of a particular parameter in this ParameterList.
|
(package private) void |
writeV3Value(int index,
PGStream pgStream) |
private static final byte IN
private static final byte OUT
private static final byte INOUT
private static final byte TEXT
private static final byte BINARY
private final java.lang.Object[] paramValues
private final int[] paramTypes
private final byte[] flags
private final byte[][] encoded
private final TypeTransferModeRegistry transferModeRegistry
private static final java.lang.Object NULL_OBJECT
private int pos
SimpleParameterList(int paramCount, TypeTransferModeRegistry transferModeRegistry)
public void registerOutParameter(int index, int sqlType) throws java.sql.SQLException
registerOutParameter
in interface ParameterList
java.sql.SQLException
private void bind(int index, java.lang.Object value, int oid, byte binary) throws java.sql.SQLException
java.sql.SQLException
public int getParameterCount()
ParameterList
getParameterCount
in interface ParameterList
public int getOutParameterCount()
ParameterList
getOutParameterCount
in interface ParameterList
public int getInParameterCount()
ParameterList
getInParameterCount
in interface ParameterList
public void setIntParameter(int index, int value) throws java.sql.SQLException
ParameterList
setIntParameter
in interface ParameterList
index
- the 1-based parameter index to bind.value
- the integer value to use.java.sql.SQLException
- on error or if index
is out of rangepublic void setLiteralParameter(int index, java.lang.String value, int oid) throws java.sql.SQLException
ParameterList
setLiteralParameter
in interface ParameterList
index
- the 1-based parameter index to bind.value
- the unquoted literal string to use.oid
- the type OID of the parameter, or 0
to infer the type.java.sql.SQLException
- on error or if index
is out of rangepublic void setStringParameter(int index, java.lang.String value, int oid) throws java.sql.SQLException
ParameterList
setStringParameter
in interface ParameterList
index
- the 1-based parameter index to bind.value
- the quoted string to use.oid
- the type OID of the parameter, or 0
to infer the type.java.sql.SQLException
- on error or if index
is out of rangepublic void setBinaryParameter(int index, byte[] value, int oid) throws java.sql.SQLException
ParameterList
setBinaryParameter
in interface ParameterList
index
- the 1-based parameter index to bind.value
- the bytes to send.oid
- the type OID of the parameter.java.sql.SQLException
- on error or if index
is out of rangepublic void setBytea(int index, byte[] data, int offset, int length) throws java.sql.SQLException
ParameterList
setBytea
in interface ParameterList
index
- the 1-based parameter index to bind.data
- an array containing the raw data valueoffset
- the offset within data
of the start of the parameter data.length
- the number of bytes of parameter data within data
to use.java.sql.SQLException
- on error or if index
is out of rangepublic void setBytea(int index, java.io.InputStream stream, int length) throws java.sql.SQLException
ParameterList
setBytea
in interface ParameterList
index
- the 1-based parameter index to bind.stream
- a stream containing the parameter data.length
- the number of bytes of parameter data to read from stream
.java.sql.SQLException
- on error or if index
is out of rangepublic void setBytea(int index, java.io.InputStream stream) throws java.sql.SQLException
ParameterList
setBytea
in interface ParameterList
index
- the 1-based parameter index to bind.stream
- a stream containing the parameter data.java.sql.SQLException
- on error or if index
is out of rangepublic void setBytea(int index, ByteStreamWriter writer) throws java.sql.SQLException
ParameterList
setBytea
in interface ParameterList
index
- the 1-based parameter index to bind.writer
- a writer that can write the bytes for the parameterjava.sql.SQLException
- on error or if index
is out of rangepublic void setText(int index, java.io.InputStream stream) throws java.sql.SQLException
ParameterList
setText
in interface ParameterList
index
- the 1-based parameter index to bind.stream
- a stream containing the parameter data.java.sql.SQLException
- on error or if index
is out of rangepublic void setNull(int index, int oid) throws java.sql.SQLException
ParameterList
setNull
in interface ParameterList
index
- the 1-based parameter index to bind.oid
- the type OID of the parameter, or 0
to infer the type.java.sql.SQLException
- on error or if index
is out of rangepublic java.lang.String toString(int index, boolean standardConformingStrings)
ParameterList
toString
in interface ParameterList
index
- the 1-based parameter index to bind.standardConformingStrings
- true if \ is not an escape character in strings literalspublic void checkAllParametersSet() throws java.sql.SQLException
V3ParameterList
checkAllParametersSet
in interface V3ParameterList
java.sql.SQLException
- if not all parameters are set.public void convertFunctionOutParameters()
V3ParameterList
convertFunctionOutParameters
in interface V3ParameterList
private static void streamBytea(PGStream pgStream, StreamWrapper wrapper) throws java.io.IOException
java.io.IOException
private static void streamBytea(PGStream pgStream, ByteStreamWriter writer) throws java.io.IOException
java.io.IOException
public int[] getTypeOIDs()
ParameterList
getTypeOIDs
in interface ParameterList
int getTypeOID(int index)
boolean hasUnresolvedTypes()
void setResolvedType(int index, int oid)
boolean isNull(int index)
boolean isBinary(int index)
private byte direction(int index)
int getV3Length(int index)
void writeV3Value(int index, PGStream pgStream) throws java.io.IOException
java.io.IOException
public ParameterList copy()
ParameterList
copy
in interface ParameterList
public void clear()
ParameterList
clear
in interface ParameterList
public SimpleParameterList[] getSubparams()
V3ParameterList
getSubparams
in interface V3ParameterList
null
if this object is
already a single-statement parameter list.public java.lang.Object[] getValues()
ParameterList
getValues
in interface ParameterList
public int[] getParamTypes()
V3ParameterList
getParamTypes
in interface V3ParameterList
Oid
type informationpublic byte[] getFlags()
V3ParameterList
getFlags
in interface V3ParameterList
public byte[][] getEncoding()
V3ParameterList
getEncoding
in interface V3ParameterList
public void appendAll(ParameterList list) throws java.sql.SQLException
ParameterList
appendAll
in interface ParameterList
list
- of parameters to append with.java.sql.SQLException
- fault raised if driver or back end throw an exceptionpublic java.lang.String toString()
toString
in class java.lang.Object