本文整理汇总了Java中org.springframework.jdbc.core.SqlOutParameter类的典型用法代码示例。如果您正苦于以下问题:Java SqlOutParameter类的具体用法?Java SqlOutParameter怎么用?Java SqlOutParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlOutParameter类属于org.springframework.jdbc.core包,在下文中一共展示了SqlOutParameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAccessTokenFromSecureStore
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
private OAuth2AccessToken readAccessTokenFromSecureStore(String tokenKey) {
if (tokenKey.length() > TOKEN_KEY_MAX_LENGTH) {
throw new IllegalArgumentException(Messages.TOKEN_KEY_FORMAT_NOT_VALID);
}
SqlParameter storeNameParam = new SqlParameter(Types.VARCHAR);
SqlParameter forXsApplicationUserParam = new SqlParameter(Types.BOOLEAN);
SqlParameter keyParam = new SqlParameter(Types.VARCHAR);
SqlOutParameter valueParam = new SqlOutParameter("VALUE", Types.VARBINARY);
List<SqlParameter> paramList = Arrays.asList(storeNameParam, forXsApplicationUserParam, keyParam, valueParam);
Map<String, Object> result = null;
try {
result = callRetrieve(tokenKey, paramList, PROCEDURE_SECURESTORE_RETRIEVE);
} catch (BadSqlGrammarException e) {
throwIfShouldNotIgnore(e, RETRIEVE_PROCEDURE_NAME);
result = callRetrieve(tokenKey, paramList, PROCEDURE_SECURESTORE_RETRIEVE_LEGACY);
}
byte[] tokenBytes = (byte[]) result.get("VALUE");
if (tokenBytes == null) {
throw new IllegalArgumentException(Messages.TOKEN_NOT_FOUND_IN_SECURE_STORE);
}
byte[] decompressedBytes = CompressUtil.decompress(tokenBytes);
OAuth2AccessToken accessToken = TokenUtil.createToken(new String(decompressedBytes, StandardCharsets.UTF_8));
return accessToken;
}
示例2: clearFileKeys
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
/**
* 调用存储过程的方法:存储过程实现具体看PKG_SYS.sql
* <B>方法名称:</B>清空文件缓存方法<BR>
* <B>概要说明:</B>清空文件缓存方法<BR>
* @return List<String> 主键KEY集合
*/
public List<String> clearFileKeys() {
SimpleJdbcCall call = new SimpleJdbcCall(this.getJdbcTemplate()).
withCatalogName("PKG_SYS").withProcedureName("CLEAR_FILES").
declareParameters(new SqlOutParameter("P_RET_REFCUR", OracleTypes.CURSOR));
Map<String, Object> m = call.execute();
if(m.values().size() > 0){
String temp = m.values().toArray()[0].toString().replace("[", "").replace("]", "");
String[] keys = temp.split(",");
List<String> ret = new ArrayList<String>();
for(String key : keys){
String temp1 = key.replace("{", "").replace("}", "");
if(!StringUtils.isBlank(temp1)){
ret.add(temp1.split("\\=")[1]);
}
}
return ret;
}
return Collections.emptyList();
}
示例3: TemplateStoredProcedure
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public TemplateStoredProcedure(JdbcTemplate jdbcTemplate, Template template) {
this.template = template;
setDataSource(jdbcTemplate.getDataSource());
setSql(template.getProcedureName());
for (Object parameter : template.getParameterList()) {
if (parameter instanceof InputParameter) {
InputParameter inputParameter = (InputParameter) parameter;
declareParameter(new SqlParameter(inputParameter.getName(), inputParameter.getSqlType()));
inputParameterList.add(inputParameter);
} else if (parameter instanceof OutParameter) {
OutParameter outParameter = (OutParameter) parameter;
declareParameter(new SqlOutParameter(outParameter.getOutValueMapKey(), outParameter.getSqlType()));
setFunction(false);
}
}
LOG.debug("Compiling stored procedure: {}", template.getProcedureName());
compile();
}
示例4: testAddInvoiceProcWithoutMetaDataUsingMapParamSource
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testAddInvoiceProcWithoutMetaDataUsingMapParamSource() throws Exception {
initializeAddInvoiceWithoutMetaData(false);
SimpleJdbcCall adder = new SimpleJdbcCall(dataSource).withProcedureName("add_invoice");
adder.declareParameters(
new SqlParameter("amount", Types.INTEGER),
new SqlParameter("custid", Types.INTEGER),
new SqlOutParameter("newid",
Types.INTEGER));
Number newId = adder.executeObject(Number.class, new MapSqlParameterSource().
addValue("amount", 1103).
addValue("custid", 3));
assertEquals(4, newId.intValue());
verifyAddInvoiceWithoutMetaData(false);
verify(connection, atLeastOnce()).close();
}
示例5: get
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Override
public String [] get() throws Exception
{
SimpleJdbcCall call = new SimpleJdbcCall(this.getJdbcTemplate());
call.withFunctionName("usecase01_get");
call.withSchemaName("public");
call.withoutProcedureColumnMetaDataAccess();
call.declareParameters(new SqlOutParameter("testcolumn", java.sql.Types.ARRAY));
MapSqlParameterSource map = new MapSqlParameterSource();
Map<String, Object> result = call.execute(map);
Jdbc4Array jdbc4Array = (Jdbc4Array)result.get("testcolumn");
try {
Object o = jdbc4Array.getArray();
Logger.getLogger(PostgresArrayImpl.class.getName()).log(Level.SEVERE, null, o);
return (String [])o;
} catch (SQLException ex) {
Logger.getLogger(PostgresArrayImpl.class.getName()).log(Level.SEVERE, null, ex);
throw ex;
}
}
示例6: createDefaultOutParameter
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Override
public SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta) {
if (meta.getSqlType() == Types.OTHER && REF_CURSOR_NAME.equals(meta.getTypeName())) {
return new SqlOutParameter(parameterName, getRefCursorSqlType(), new ColumnMapRowMapper());
}
else {
return super.createDefaultOutParameter(parameterName, meta);
}
}
示例7: createDefaultOutParameter
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Override
public SqlParameter createDefaultOutParameter(String parameterName, CallParameterMetaData meta) {
if (meta.getSqlType() == Types.OTHER && "refcursor".equals(meta.getTypeName())) {
return new SqlOutParameter(parameterName, getRefCursorSqlType(), new ColumnMapRowMapper());
}
else {
return super.createDefaultOutParameter(parameterName, meta);
}
}
示例8: createReturnResultSetParameter
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
/**
* Create a ReturnResultSetParameter/SqlOutParameter depending on the support provided
* by the JDBC driver used for the database in use.
* @param parameterName the name of the parameter (also used as the name of the List returned in the output)
* @param rowMapper a RowMapper implementation used to map the data returned in the result set
* @return the appropriate SqlParameter
*/
public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper<?> rowMapper) {
if (this.metaDataProvider.isReturnResultSetSupported()) {
return new SqlReturnResultSet(parameterName, rowMapper);
}
else {
if (this.metaDataProvider.isRefCursorSupported()) {
return new SqlOutParameter(parameterName, this.metaDataProvider.getRefCursorSqlType(), rowMapper);
}
else {
throw new InvalidDataAccessApiUsageException("Return of a ResultSet from a stored procedure is not supported.");
}
}
}
示例9: StoredProcedureConfiguredViaJdbcTemplate
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public StoredProcedureConfiguredViaJdbcTemplate(JdbcTemplate t) {
setJdbcTemplate(t);
setSql(SQL);
declareParameter(new SqlParameter("intIn", Types.INTEGER));
declareParameter(new SqlOutParameter("intOut", Types.INTEGER));
compile();
}
示例10: AddInvoice
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public AddInvoice(DataSource ds) {
setDataSource(ds);
setSql(SQL);
declareParameter(new SqlParameter("amount", Types.INTEGER));
declareParameter(new SqlParameter("custid", Types.INTEGER));
declareParameter(new SqlOutParameter("newid", Types.INTEGER));
compile();
}
示例11: ParameterMapperStoredProcedure
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public ParameterMapperStoredProcedure(DataSource ds) {
setDataSource(ds);
setSql(SQL);
declareParameter(new SqlParameter("in", Types.VARCHAR));
declareParameter(new SqlOutParameter("out", Types.VARCHAR));
compile();
}
示例12: SqlTypeValueStoredProcedure
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public SqlTypeValueStoredProcedure(DataSource ds) {
setDataSource(ds);
setSql(SQL);
declareParameter(new SqlParameter("in", Types.ARRAY, "NUMBERS"));
declareParameter(new SqlOutParameter("out", Types.VARCHAR));
compile();
}
示例13: validateInOutParameter
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void validateInOutParameter() {
operation.setDataSource(new DriverManagerDataSource());
operation.setSql("DUMMY_PROC");
operation.declareParameter(new SqlOutParameter("DUMMY_OUT_PARAM", Types.VARCHAR));
operation.declareParameter(new SqlInOutParameter("DUMMY_IN_OUT_PARAM", Types.VARCHAR));
operation.validateParameters(new Object[] {"DUMMY_VALUE1", "DUMMY_VALUE2"});
}
示例14: testAddInvoiceProcWithoutMetaDataUsingMapParamSource
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testAddInvoiceProcWithoutMetaDataUsingMapParamSource() throws Exception {
initializeAddInvoiceWithoutMetaData(false);
SimpleJdbcCall adder = new SimpleJdbcCall(dataSource).withProcedureName("add_invoice");
adder.declareParameters(
new SqlParameter("amount", Types.INTEGER),
new SqlParameter("custid", Types.INTEGER),
new SqlOutParameter("newid", Types.INTEGER));
Number newId = adder.executeObject(Number.class, new MapSqlParameterSource().
addValue("amount", 1103).
addValue("custid", 3));
assertEquals(4, newId.intValue());
verifyAddInvoiceWithoutMetaData(false);
verify(connection, atLeastOnce()).close();
}
示例15: testAddInvoiceProcWithoutMetaDataUsingArrayParams
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testAddInvoiceProcWithoutMetaDataUsingArrayParams() throws Exception {
initializeAddInvoiceWithoutMetaData(false);
SimpleJdbcCall adder = new SimpleJdbcCall(dataSource).withProcedureName("add_invoice");
adder.declareParameters(
new SqlParameter("amount", Types.INTEGER),
new SqlParameter("custid", Types.INTEGER),
new SqlOutParameter("newid", Types.INTEGER));
Number newId = adder.executeObject(Number.class, 1103, 3);
assertEquals(4, newId.intValue());
verifyAddInvoiceWithoutMetaData(false);
verify(connection, atLeastOnce()).close();
}