use of org.springframework.jdbc.core.simple.SimpleJdbcCall in project ovirt-engine by oVirt.
the class AuditLogDaoImpl method getTimeToWaitForNextPmOp.
@Override
public int getTimeToWaitForNextPmOp(String vdsName, String event) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vds_name", vdsName).addValue("event", event).addValue("wait_for_sec", Config.getValue(ConfigValues.FenceQuietTimeBetweenOperationsInSec));
Map<String, Object> dbResults = new SimpleJdbcCall(getJdbcTemplate()).withFunctionName("get_seconds_to_wait_before_pm_operation").execute(parameterSource);
String resultKey = dbEngineDialect.getFunctionReturnKey();
return (Integer) dbResults.getOrDefault(resultKey, 0);
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCall in project ovirt-engine by oVirt.
the class EntityDaoImpl method getEntityNameByIdAndType.
@Override
public String getEntityNameByIdAndType(Guid objectId, VdcObjectType vdcObjectType) {
MapSqlParameterSource parameterSource = sqlParameterSourceProvider.get().addValue("entity_id", objectId).addValue("object_type", vdcObjectType.getValue());
Map<String, Object> dbResults = new SimpleJdbcCall(jdbcTemplate).withFunctionName("fn_get_entity_name").execute(parameterSource);
String resultKey = dbEngineDialect.getFunctionReturnKey();
return dbResults.get(resultKey) != null ? dbResults.get(resultKey).toString() : null;
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCall in project ovirt-engine by oVirt.
the class VdsStaticDaoImpl method save.
@Override
public void save(VdsStatic vds) {
Guid id = vds.getId();
if (Guid.isNullOrEmpty(id)) {
id = Guid.newGuid();
vds.setId(id);
}
new SimpleJdbcCall(getJdbcTemplate()).withProcedureName("InsertVdsStatic").execute(getInsertOrUpdateParams(vds));
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCall in project spring-integration by spring-projects.
the class StoredProcExecutorTests method mockTheOperationsCache.
private void mockTheOperationsCache(final StoredProcExecutor storedProcExecutor) {
Object cache = TestUtils.getPropertyValue(storedProcExecutor, "guavaCacheWrapper.jdbcCallOperationsCache.localCache");
new DirectFieldAccessor(cache).setPropertyValue("defaultLoader", new CacheLoader<String, SimpleJdbcCallOperations>() {
@Override
public SimpleJdbcCall load(String storedProcedureName) {
return mock(SimpleJdbcCall.class);
}
});
}
use of org.springframework.jdbc.core.simple.SimpleJdbcCall in project spring-integration by spring-projects.
the class StoredProcExecutor method createSimpleJdbcCall.
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;
}
Aggregations