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.DBGroupDAOImpl.java

@Override
public List<String> getCapacityGroups(String envId) throws Exception {
    return new QueryRunner(dataSource).query(GET_GROUPS,
            SingleResultSetHandlerFactory.<String>newListObjectHandler(), envId);
}

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

@Override
public void deleteAllAutoScalingGroupByCluster(String clusterName) throws Exception {
    new QueryRunner(dataSource).update(DELETE_ASG_BY_CLUSTER, clusterName);
}

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

@Override
public GroupRolesBean getByNameAndResource(String groupName, String resourceId, Resource.Type resourceType)
        throws Exception {
    ResultSetHandler<GroupRolesBean> h = new BeanHandler<>(GroupRolesBean.class);
    return new QueryRunner(dataSource).query(GET_BY_NAME_AND_RESOURCE, h, groupName, resourceId,
            resourceType.toString());/*  w w w  .ja v a 2  s  .  com*/
}

From source file:jongo.jdbc.JDBCConnectionFactory.java

/**
 * Instantiates a new {@linkplain org.apache.commons.dbutils.QueryRunner} for the given database.
 * @param dbcfg a registered {@link jongo.config.DatabaseConfiguration}
 * @return a new {@linkplain org.apache.commons.dbutils.QueryRunner}
 *//* ww  w.j a v  a  2 s  .com*/
public static QueryRunner getQueryRunner(final DatabaseConfiguration dbcfg) {
    DataSource ds = getDataSource(dbcfg);
    return new QueryRunner(ds);
}

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

@Override
public void removeHealthCheckById(String id) throws Exception {
    new QueryRunner(dataSource).update(DELETE_HRALTH_CHECK_BY_ID, id);
}

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

@Override
public void deleteAlarmInfoById(String alarmId) throws Exception {
    new QueryRunner(dataSource).update(DELETE_ALARM_BY_ID, alarmId);
}

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

@Override
public DeployBean getById(String deploymentId) throws Exception {
    ResultSetHandler<DeployBean> h = new BeanHandler<>(DeployBean.class);
    return new QueryRunner(dataSource).query(GET_DEPLOYMENT_BY_ID, h, deploymentId);
}

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

@Override
public List<TagBean> getByValue(TagValue value) throws Exception {
    ResultSetHandler<List<TagBean>> h = new BeanListHandler<TagBean>(TagBean.class);
    return new QueryRunner(basicDataSource).query(GET_TAG_BY_VALUE, h, value.toString());

}

From source file:com.qnoid.java.t0RZ.PersonService.java

public List<Person> list() throws SQLException {
    QueryRunner queryRunner = new QueryRunner(this.datasource);

    return queryRunner.query(SELECT_PERSONS, PERSONS_HANDLER);
}

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

@Override
public void updateGroupInfo(String groupName, GroupBean bean) throws Exception {
    if (bean.getLast_update() == null) {
        bean.setLast_update(System.currentTimeMillis());
    }/* w  ww . ja v  a2 s  .  c om*/
    SetClause setClause = bean.genSetClause();
    String clause = String.format(UPDATE_GROUP_INFO, setClause.getClause());
    setClause.addValue(groupName);
    new QueryRunner(dataSource).update(clause, setClause.getValueArray());
}