Example usage for org.apache.commons.dbutils QueryRunner QueryRunner

List of usage examples for org.apache.commons.dbutils QueryRunner QueryRunner

Introduction

In this page you can find the example usage for org.apache.commons.dbutils QueryRunner QueryRunner.

Prototype

public QueryRunner(DataSource ds) 

Source Link

Document

Constructor for QueryRunner that takes a DataSource to use.

Usage

From source file:com.pinterest.deployservice.db.DBAgentErrorDAOImpl.java

@Override
public AgentErrorBean getByHostIdAndEnvId(String hostId, String envId) throws Exception {
    ResultSetHandler<AgentErrorBean> h = new BeanHandler<AgentErrorBean>(AgentErrorBean.class);
    return new QueryRunner(dataSource).query(GET_ERROR_BY_HOSTID_AND_ENVID, h, hostId, envId);
}

From source file:com.pinterest.arcee.db.DBAsgLifecycleEventDAOImpl.java

@Override
public List<AsgLifecycleEventBean> getAsgLifecycleEventByHook(String hookId) throws Exception {
    ResultSetHandler<List<AsgLifecycleEventBean>> h = new BeanListHandler<AsgLifecycleEventBean>(
            AsgLifecycleEventBean.class);
    return new QueryRunner(dataSource).query(GET_ASG_LIFE_CYCLE_EVENT_BY_HOOK, h, hookId);
}

From source file:com.pinterest.deployservice.db.DBPromoteDAOImpl.java

@Override
public void update(String envId, PromoteBean promoteBean) throws Exception {
    SetClause setClause = promoteBean.genSetClause();
    String clause = String.format(UPDATE_TEMPLATE, setClause.getClause());
    setClause.addValue(envId);/*from   w  ww.j ava 2  s  . c o m*/
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.pinterest.deployservice.db.DBScheduleDAOImpl.java

@Override
public ScheduleBean getById(String scheduleId) throws Exception {
    ResultSetHandler<ScheduleBean> h = new BeanHandler<ScheduleBean>(ScheduleBean.class);
    ScheduleBean bean = new QueryRunner(dataSource).query(GET_SCHEDULE_BY_ID, h, scheduleId);
    return bean;/*from w w w  . j  a  v a2 s  . c  o  m*/
}

From source file:azkaban.trigger.JdbcTriggerImplTest.java

@Before
public void setUp() {

    dbOperator = new DatabaseOperatorImpl(new QueryRunner(dataSource));
    loader = new JdbcTriggerImpl(dbOperator);
}

From source file:com.pinterest.arcee.db.DBAlarmDAOImpl.java

@Override
public AsgAlarmBean getAlarmInfoByGroupAndMetricSource(String groupName, String metricSource) throws Exception {
    ResultSetHandler<AsgAlarmBean> h = new BeanHandler<AsgAlarmBean>(AsgAlarmBean.class);
    return new QueryRunner(dataSource).query(GET_BY_GROUP_AND_METRICSOURCE, h, groupName, metricSource);
}

From source file:com.pinterest.clusterservice.db.DBSecurityZoneDAOImpl.java

@Override
public Collection<SecurityZoneBean> getByProviderAndBasic(String provider, boolean basic) throws Exception {
    ResultSetHandler<List<SecurityZoneBean>> h = new BeanListHandler<SecurityZoneBean>(SecurityZoneBean.class);
    return new QueryRunner(dataSource).query(GET_BY_PROVIDER_AND_BASIC, h, provider, basic);
}

From source file:com.pinterest.arcee.db.DBHealthCheckDAOImpl.java

@Override
public void insertHealthCheck(HealthCheckBean healthCheckBean) throws Exception {
    SetClause setClause = healthCheckBean.genSetClause();
    String clause = String.format(INSERT_HEALTH_CHECK, setClause.getClause());
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}

From source file:com.pinterest.clusterservice.db.DBClusterDAOImpl.java

@Override
public String getProviderByClusterName(String clusterName) throws Exception {
    return new QueryRunner(dataSource).query(GET_PROVIDER_BY_CLUSTERNAME,
            SingleResultSetHandlerFactory.<String>newObjectHandler(), clusterName);
}

From source file:com.pinterest.deployservice.db.DBHotfixDAOImpl.java

@Override
public List<String> getOngoingHotfixIds() throws Exception {
    String statesClause = QueryUtils.genEnumGroupClause(StateMachines.HOTFIX_ONGOING_STATES);
    return new QueryRunner(dataSource).query(String.format(GET_ONGOING_HOTFIX_IDS_TEMPLATE, statesClause),
            SingleResultSetHandlerFactory.<String>newListObjectHandler());
}