本文整理了Java中org.springframework.jdbc.core.JdbcTemplate.setSkipUndeclaredResults()
方法的一些代码示例,展示了JdbcTemplate.setSkipUndeclaredResults()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JdbcTemplate.setSkipUndeclaredResults()
方法的具体详情如下:
包路径:org.springframework.jdbc.core.JdbcTemplate
类名称:JdbcTemplate
方法名:setSkipUndeclaredResults
[英]Set whether undeclared results should be skipped.
[中]设置是否应跳过未声明的结果。
代码示例来源:origin: spring-projects/spring-framework
@Test
@SuppressWarnings("unchecked")
public void testStoredProcedureSkippingUndeclaredResults() throws Exception {
ResultSet resultSet = mock(ResultSet.class);
given(resultSet.next()).willReturn(true, true, false);
given(resultSet.getString(2)).willReturn("Foo", "Bar");
given(callableStatement.execute()).willReturn(true);
given(callableStatement.getUpdateCount()).willReturn(-1);
given(callableStatement.getResultSet()).willReturn(resultSet);
given(callableStatement.getMoreResults()).willReturn(true, false);
given(callableStatement.getUpdateCount()).willReturn(-1, -1);
given(connection.prepareCall("{call " + StoredProcedureWithResultSetMapped.SQL + "()}")
).willReturn(callableStatement);
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.setSkipUndeclaredResults(true);
StoredProcedureWithResultSetMapped sproc = new StoredProcedureWithResultSetMapped(
jdbcTemplate);
Map<String, Object> res = sproc.execute();
assertEquals("incorrect number of returns", 1, res.size());
List<String> rs1 = (List<String>) res.get("rs");
assertEquals(2, rs1.size());
assertEquals("Foo", rs1.get(0));
assertEquals("Bar", rs1.get(1));
verify(resultSet).close();
}
代码示例来源:origin: spring-projects/spring-integration
private SimpleJdbcCall createSimpleJdbcCall(String storedProcedureName) {
final SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(this.dataSource);
if (this.isFunction) {
simpleJdbcCall.withFunctionName(storedProcedureName);
}
else {
simpleJdbcCall.withProcedureName(storedProcedureName);
}
if (this.ignoreColumnMetaData) {
simpleJdbcCall.withoutProcedureColumnMetaDataAccess();
}
simpleJdbcCall.declareParameters(this.sqlParameters.toArray(new SqlParameter[this.sqlParameters.size()]));
if (!this.returningResultSetRowMappers.isEmpty()) {
for (Entry<String, RowMapper<?>> mapEntry : this.returningResultSetRowMappers.entrySet()) {
simpleJdbcCall.returningResultSet(mapEntry.getKey(), mapEntry.getValue());
}
}
if (this.returnValueRequired) {
simpleJdbcCall.withReturnValue();
}
simpleJdbcCall.getJdbcTemplate().setSkipUndeclaredResults(this.skipUndeclaredResults);
return simpleJdbcCall;
}
代码示例来源:origin: io.bufferslayer/buffer-spring-jdbc
public void setSkipUndeclaredResults(boolean skipUndeclaredResults) {
delegate.setSkipUndeclaredResults(skipUndeclaredResults);
}
代码示例来源:origin: io.bufferslayer/bufferslayer-spring-jdbc
public void setSkipUndeclaredResults(boolean skipUndeclaredResults) {
delegate.setSkipUndeclaredResults(skipUndeclaredResults);
}
代码示例来源:origin: org.springframework.integration/spring-integration-jdbc
private SimpleJdbcCall createSimpleJdbcCall(String storedProcedureName) {
final SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(this.dataSource);
if (this.isFunction) {
simpleJdbcCall.withFunctionName(storedProcedureName);
}
else {
simpleJdbcCall.withProcedureName(storedProcedureName);
}
if (this.ignoreColumnMetaData) {
simpleJdbcCall.withoutProcedureColumnMetaDataAccess();
}
simpleJdbcCall.declareParameters(this.sqlParameters.toArray(new SqlParameter[this.sqlParameters.size()]));
if (!this.returningResultSetRowMappers.isEmpty()) {
for (Entry<String, RowMapper<?>> mapEntry : this.returningResultSetRowMappers.entrySet()) {
simpleJdbcCall.returningResultSet(mapEntry.getKey(), mapEntry.getValue());
}
}
if (this.returnValueRequired) {
simpleJdbcCall.withReturnValue();
}
simpleJdbcCall.getJdbcTemplate().setSkipUndeclaredResults(this.skipUndeclaredResults);
return simpleJdbcCall;
}
代码示例来源:origin: fast-sql/FastSQL
/**
* 创建一个SQL实例
*/
public SQL sql() {
if (this.jdbcTemplate == null) {
this.jdbcTemplate = new JdbcTemplate();
this.jdbcTemplate.setIgnoreWarnings(ignoreWarnings);
this.jdbcTemplate.setFetchSize(fetchSize);
this.jdbcTemplate.setMaxRows(maxRows);
this.jdbcTemplate.setQueryTimeout(queryTimeout);
this.jdbcTemplate.setSkipResultsProcessing(skipResultsProcessing);
this.jdbcTemplate.setSkipUndeclaredResults(skipUndeclaredResults);
this.jdbcTemplate.setResultsMapCaseInsensitive(resultsMapCaseInsensitive);
this.jdbcTemplate.setDataSource(this.dataSource);
}
return new SQL(this.jdbcTemplate, this.dataSourceType);
}
内容来源于网络,如有侵权,请联系作者删除!