public interface ParameterList
Abstraction of a list of parameters to be substituted into a Query. The protocol-specific details of how to efficiently store and stream the parameters is hidden behind implementations of this interface.
In general, instances of ParameterList are associated with a particular Query object (the one that created them) and shouldn't be used against another Query.
Parameter indexes are 1-based to match JDBC's PreparedStatement, i.e. the first parameter has index 1.
Modifier and Type | Method | Description |
---|---|---|
void |
appendAll(ParameterList list) |
Use this operation to append more parameters to the current list.
|
void |
clear() |
Unbind all parameter values bound in this list.
|
ParameterList |
copy() |
Perform a shallow copy of this ParameterList, returning a new instance (still suitable for
passing to the owning Query).
|
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[] |
getTypeOIDs() |
Return the oids of the parameters in this list.
|
java.lang.Object[] |
getValues() |
Returns the bound parameter values.
|
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,
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.
|
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.
|
java.lang.String |
toString(int index,
boolean standardConformingStrings) |
Return a human-readable representation of a particular parameter in this ParameterList.
|
void registerOutParameter(int index, int sqlType) throws java.sql.SQLException
java.sql.SQLException
int getParameterCount()
int getInParameterCount()
int getOutParameterCount()
int[] getTypeOIDs()
void setIntParameter(int index, int value) throws java.sql.SQLException
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 rangevoid setLiteralParameter(int index, java.lang.String value, int oid) throws java.sql.SQLException
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 rangevoid setStringParameter(int index, java.lang.String value, int oid) throws java.sql.SQLException
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 rangevoid setBytea(int index, byte[] data, int offset, int length) throws java.sql.SQLException
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 rangevoid setBytea(int index, java.io.InputStream stream, int length) throws java.sql.SQLException
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 rangevoid setBytea(int index, java.io.InputStream stream) throws java.sql.SQLException
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 rangevoid setText(int index, java.io.InputStream stream) throws java.sql.SQLException
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 rangevoid setBinaryParameter(int index, byte[] value, int oid) throws java.sql.SQLException
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 rangevoid setNull(int index, int oid) throws java.sql.SQLException
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 rangeParameterList copy()
void clear()
java.lang.String toString(int index, boolean standardConformingStrings)
index
- the 1-based parameter index to bind.standardConformingStrings
- true if \ is not an escape character in strings literalsvoid appendAll(ParameterList list) throws java.sql.SQLException
list
- of parameters to append with.java.sql.SQLException
- fault raised if driver or back end throw an exceptionjava.lang.Object[] getValues()
Copyright © 2019 PostgreSQL Global Development Group. All rights reserved.