Search in sources :

Example 1 with CustomMapSqlParameterSource

use of org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource in project ovirt-engine by oVirt.

the class SystemStatisticsDaoImpl method getSystemStatisticsValue.

@Override
public Integer getSystemStatisticsValue(String entity, String status) {
    MapSqlParameterSource parameterSource = new CustomMapSqlParameterSource(dbEngineDialect).addValue("entity", entity).addValue("status", status);
    RowMapper<Integer> mapper = (rs, rowNum) -> rs.getInt("val");
    Map<String, Object> dbResults = dbEngineDialect.createJdbcCallForQuery(jdbcTemplate).withProcedureName("Getsystem_statistics").returningResultSet("RETURN_VALUE", mapper).execute(parameterSource);
    return (Integer) DbFacadeUtils.asSingleResult((List<?>) dbResults.get("RETURN_VALUE"));
}
Also used : Objects(java.util.Objects) Inject(javax.inject.Inject) List(java.util.List) Map(java.util.Map) RowMapper(org.springframework.jdbc.core.RowMapper) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) Named(javax.inject.Named) DbEngineDialect(org.ovirt.engine.core.dal.dbbroker.DbEngineDialect) Singleton(javax.inject.Singleton) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) DbFacadeUtils(org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate) MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource) List(java.util.List)

Example 2 with CustomMapSqlParameterSource

use of org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource in project ovirt-engine by oVirt.

the class BatchProcedureCallTest method getParamsSource.

protected CustomMapSqlParameterSource getParamsSource(Tags tag) {
    CustomMapSqlParameterSource paramsSource = new CustomMapSqlParameterSource(dbEngineDialect);
    paramsSource.addValue("description", tag.getDescription()).addValue("tag_id", tag.getTagId()).addValue("tag_name", tag.getTagName()).addValue("parent_id", tag.getParentId()).addValue("readonly", tag.getIsReadonly()).addValue("type", tag.getType());
    return paramsSource;
}
Also used : CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)

Example 3 with CustomMapSqlParameterSource

use of org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource in project ovirt-engine by oVirt.

the class InterfaceDaoImpl method massClearNetworkFromNics.

@Override
public void massClearNetworkFromNics(List<Guid> nicIds) {
    getCallsHandler().executeStoredProcAsBatch("Clear_network_from_nics", nicIds, id -> {
        CustomMapSqlParameterSource paramSource = getCustomMapSqlParameterSource();
        paramSource.addValue("id", id);
        return paramSource;
    });
}
Also used : CustomMapSqlParameterSource(org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)

Aggregations

CustomMapSqlParameterSource (org.ovirt.engine.core.dal.dbbroker.CustomMapSqlParameterSource)3 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Inject (javax.inject.Inject)1 Named (javax.inject.Named)1 Singleton (javax.inject.Singleton)1 DbEngineDialect (org.ovirt.engine.core.dal.dbbroker.DbEngineDialect)1 DbFacadeUtils (org.ovirt.engine.core.dal.dbbroker.DbFacadeUtils)1 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 RowMapper (org.springframework.jdbc.core.RowMapper)1 MapSqlParameterSource (org.springframework.jdbc.core.namedparam.MapSqlParameterSource)1