本文整理汇总了Java中org.springframework.jdbc.core.SqlOutParameter类的典型用法代码示例。如果您正苦于以下问题:Java SqlOutParameter类的具体用法?Java SqlOutParameter怎么用?Java SqlOutParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SqlOutParameter类属于org.springframework.jdbc.core包,在下文中一共展示了SqlOutParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:27,代码来源:HanaSecureTokenStore.java
示例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();
}
开发者ID:craware,项目名称:webapp-tyust,代码行数:26,代码来源:SysFileComDao.java
示例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();
}
开发者ID:HydAu,项目名称:Camel,代码行数:23,代码来源:TemplateStoredProcedure.java
示例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();
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:17,代码来源:SimpleJdbcCallTests.java
示例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;
}
}
开发者ID:davecramer,项目名称:SpringTransactionExample,代码行数:24,代码来源:PostgresArrayImpl.java
示例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);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:OracleCallMetaDataProvider.java
示例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);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:PostgresCallMetaDataProvider.java
示例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.");
}
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:CallMetaDataContext.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:StoredProcedureTests.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:StoredProcedureTests.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:StoredProcedureTests.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:StoredProcedureTests.java
示例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"});
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:9,代码来源:RdbmsOperationTests.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:SimpleJdbcCallTests.java
示例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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:SimpleJdbcCallTests.java
示例16: testAddInvoiceFuncWithoutMetaDataUsingMapParamSource
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testAddInvoiceFuncWithoutMetaDataUsingMapParamSource() throws Exception {
initializeAddInvoiceWithoutMetaData(true);
SimpleJdbcCall adder = new SimpleJdbcCall(dataSource).withFunctionName("add_invoice");
adder.declareParameters(
new SqlOutParameter("return", Types.INTEGER),
new SqlParameter("amount", Types.INTEGER),
new SqlParameter("custid", Types.INTEGER));
Number newId = adder.executeFunction(Number.class, new MapSqlParameterSource()
.addValue("amount", 1103)
.addValue("custid", 3));
assertEquals(4, newId.intValue());
verifyAddInvoiceWithoutMetaData(true);
verify(connection, atLeastOnce()).close();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:16,代码来源:SimpleJdbcCallTests.java
示例17: testAddInvoiceFuncWithoutMetaDataUsingArrayParams
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testAddInvoiceFuncWithoutMetaDataUsingArrayParams() throws Exception {
initializeAddInvoiceWithoutMetaData(true);
SimpleJdbcCall adder = new SimpleJdbcCall(dataSource).withFunctionName("add_invoice");
adder.declareParameters(
new SqlOutParameter("return", Types.INTEGER),
new SqlParameter("amount", Types.INTEGER),
new SqlParameter("custid", Types.INTEGER));
Number newId = adder.executeFunction(Number.class, 1103, 3);
assertEquals(4, newId.intValue());
verifyAddInvoiceWithoutMetaData(true);
verify(connection, atLeastOnce()).close();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:SimpleJdbcCallTests.java
示例18: testMatchParameterValuesAndSqlInOutParameters
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
@Test
public void testMatchParameterValuesAndSqlInOutParameters() throws Exception {
final String TABLE = "customers";
final String USER = "me";
given(databaseMetaData.getDatabaseProductName()).willReturn("MyDB");
given(databaseMetaData.getUserName()).willReturn(USER);
given(databaseMetaData.storesLowerCaseIdentifiers()).willReturn(true);
List<SqlParameter> parameters = new ArrayList<SqlParameter>();
parameters.add(new SqlParameter("id", Types.NUMERIC));
parameters.add(new SqlInOutParameter("name", Types.NUMERIC));
parameters.add(new SqlOutParameter("customer_no", Types.NUMERIC));
MapSqlParameterSource parameterSource = new MapSqlParameterSource();
parameterSource.addValue("id", 1);
parameterSource.addValue("name", "Sven");
parameterSource.addValue("customer_no", "12345XYZ");
context.setProcedureName(TABLE);
context.initializeMetaData(dataSource);
context.processParameters(parameters);
Map<String, Object> inParameters = context.matchInParameterValuesWithCallParameters(parameterSource);
assertEquals("Wrong number of matched in parameter values", 2, inParameters.size());
assertTrue("in parameter value missing", inParameters.containsKey("id"));
assertTrue("in out parameter value missing", inParameters.containsKey("name"));
assertTrue("out parameter value matched", !inParameters.containsKey("customer_no"));
List<String> names = context.getOutParameterNames();
assertEquals("Wrong number of out parameters", 2, names.size());
List<SqlParameter> callParameters = context.getCallParameters();
assertEquals("Wrong number of call parameters", 3, callParameters.size());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:35,代码来源:CallMetaDataContextTests.java
示例19: 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.");
}
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:21,代码来源:CallMetaDataContext.java
示例20: AddInvoiceUsingObjectArray
import org.springframework.jdbc.core.SqlOutParameter; //导入依赖的package包/类
public AddInvoiceUsingObjectArray(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();
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:9,代码来源:StoredProcedureTests.java
注:本文中的org.springframework.jdbc.core.SqlOutParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论