Package com.github.hakko.musiccabinet.dao.jdbc

Source Code of com.github.hakko.musiccabinet.dao.jdbc.JdbcFunctionCountDao

package com.github.hakko.musiccabinet.dao.jdbc;

import javax.sql.DataSource;

import org.springframework.jdbc.core.JdbcTemplate;

import com.github.hakko.musiccabinet.dao.FunctionCountDao;

public class JdbcFunctionCountDao implements FunctionCountDao, JdbcTemplateDao {

  private JdbcTemplate jdbcTemplate;

  @Override
  public int countFunctions() {
    return jdbcTemplate.queryForInt("select util.count_functions()");
  }

  @Override
  public int countFunctionsByName(String name) {
    return jdbcTemplate.queryForInt("select util.count_functions(?)", name);
  }
 
  @Override
  public JdbcTemplate getJdbcTemplate() {
    return jdbcTemplate;
  }

  // Spring setters
 
  public void setDataSource(DataSource dataSource) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
  }

}
TOP

Related Classes of com.github.hakko.musiccabinet.dao.jdbc.JdbcFunctionCountDao

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.