NamedSqlValue, org.springframework.jdbc.support.SqlValuepublic final class SqlOracleArrayValue extends Object implements NamedSqlValue
Array.
A usage example from a JdbcTemplate:
jdbcTemplate.queryForInt(SQL, new SqlOracleArrayValue("MYARRAYTYPE", values));
A usage example from a StoredProcedure:
storedProcedure.declareParameter(new SqlParameter("myarrayparameter", Types.ARRAY, "MYARRAYTYPE"));
...
Map<String, Object> inParams = new HashMap<>();
inParams.put("myarrayparameter", new SqlOracleArrayValue("MYARRAYTYPE", objectArray);
Map<String, Object> out = storedProcedure.execute(inParams);
Similar to org.springframework.data.jdbc.support.oracle.SqlArrayValue but updated for Spring 5 and later and OJDBC 11.2g and later.
| Modifier and Type | Field | Description |
|---|---|---|
private Array |
array |
|
private String |
typeName |
|
private Object[] |
values |
| Constructor | Description |
|---|---|
SqlOracleArrayValue(String typeName,
Object... values) |
Constructor that takes two parameters, one parameter with the array of values passed in to
the statement and one that takes the type name.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
cleanup() |
|
private Array |
createArray(Connection conn) |
|
void |
setValue(PreparedStatement ps,
int paramIndex) |
|
void |
setValue(PreparedStatement ps,
String paramName) |
Set the value on the given PreparedStatement.
|
private final Object[] values
private final String typeName
private Array array
public void setValue(PreparedStatement ps, int paramIndex) throws SQLException
setValue in interface org.springframework.jdbc.support.SqlValueSQLExceptionpublic void setValue(PreparedStatement ps, String paramName) throws SQLException
setValue in interface NamedSqlValueps - the PreparedStatement to work onparamName - the name of the parameter for which we need to set the valueSQLException - if a SQLException is encountered while setting parameter valuesSqlValue.setValue(PreparedStatement, int)private Array createArray(Connection conn) throws SQLException
SQLExceptionpublic void cleanup()
cleanup in interface org.springframework.jdbc.support.SqlValueCopyright © 2018. All rights reserved.