Package org.springframework.jdbc.core.namedparam

Examples of org.springframework.jdbc.core.namedparam.SqlParameterSource


    int arg1 = 24;
    String arg2 = "foo";

    MockControl mc = MockControl.createControl(NamedParameterJdbcOperations.class);
    NamedParameterJdbcOperations npjo = (NamedParameterJdbcOperations) mc.getMock();
    SqlParameterSource args = new MapSqlParameterSource().addValue("id", arg1).addValue("xy", arg2);
    npjo.queryForInt(sql, args);
    mc.setDefaultMatcher(new ArrayMatcher());
    mc.setReturnValue(expectedResult);
    mc.replay();
View Full Code Here


   * @see
   * com.odb.core.dao.ODBDAO#getDataSourceByDataSourceID(java.lang.String)
   */
  public DataSourceInfo getDataSourceByDataSourceID(String dsID) throws SQLException {
    String sql = "SELECT * FROM ODB_DATASOURCE_INFO WHERE DATASOURCE_ID=:dataSourceID";
    SqlParameterSource param = new MapSqlParameterSource("dataSourceID", dsID);
    return jdbcTemp.query(sql, param, new DataSourceInfoResultSetExtractor());
  }
View Full Code Here

   *
   * @see com.odb.core.dao.ODBDAO#getDataSourceAxisInfo(java.lang.String)
   */
  public List<DataSourceAxisInfo> getDataSourceAxisInfo(String dataSourceID) throws SQLException {
    String sql = "select * from ODB_DATASOURCE_AXIS_CONFIG where DATASOURCE_ID=:dataSourceID";
    SqlParameterSource param = new MapSqlParameterSource("dataSourceID", dataSourceID);
    return jdbcTemp.query(sql, param, new DataSourceAxisInfoRowMapper());
  }
View Full Code Here

   * com.odb.core.dao.ODBDAO#getDataSourceAxisDetailInfoListBy(java.lang.String
   * )
   */
  public List<DataSourceAxisDetailInfo> getDataSourceAxisDetailInfoListBy(String axisId) throws SQLException {
    String sql = "SELECT * FROM ODB_DATASOURCE_AXIS_DTL_CONFIG WHERE DATASOURCE_AXIS_ID=:dataSourceAxisID";
    SqlParameterSource param = new MapSqlParameterSource("dataSourceAxisID", axisId);
    return jdbcTemp.query(sql, param, new DataSourceAxisDetailInfoRowMapper());
  }
View Full Code Here

    @Override
    public int addFileHistory(FileHistory fileHistory) {
        String sql = "insert into config_file_history(app_name, file_name, version, xml, comment, creator, create_time, is_published, publisher, publish_time) " +
                "values(:appName, :fileName, :version, :xml, :comment, :creator, :createTime, :published, :publisher, :publishTime)";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(fileHistory);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

    @Override
    public int addApp(App app) {
        String sql = "insert into config_app(app_name, description, creator, create_time) " +
                "values(:appName, :description, :creator, :createTime)";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(app);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

    @Override
    public int addFilePublished(FilePublished filePublished) {
        String sql = "insert into config_file_published(app_name, file_name, version, xml, md5) " +
                "values(:appName, :fileName, :version, :xml, :md5)";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(filePublished);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

    @Override
    public int updateFilePublished(FilePublished filePublished) {
        String sql = "update config_file_published set version=:version, xml=:xml, md5=:md5 " +
                "where app_name=:appName and file_name=:fileName";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(filePublished);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

    @Override
    public int addFileCurrent(FileCurrent fileCurrent) {
        String sql = "insert into config_file_current(app_name, file_name, version, xml, comment, creator, create_time, last_publish_version, last_publisher, last_publish_time) " +
                "values(:appName, :fileName, :version, :xml, :comment, :creator, :createTime, :lastPublishVersion, :lastPublisher, :lastPublishTime)";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(fileCurrent);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

    public int updateFileCurrent(FileCurrent fileCurrent) {
        String sql = "update config_file_current " +
                "set version=:version, xml=:xml, comment=:comment, creator=:creator, create_time=:createTime, " +
                "last_publish_version=:lastPublishVersion, last_publisher=:lastPublisher, last_publish_time=:lastPublishTime" +
                " where app_name=:appName and file_name=:fileName";
        SqlParameterSource bpsp = new BeanPropertySqlParameterSource(fileCurrent);
        return getNamedParameterJdbcTemplate().update(sql, bpsp);
    }
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.namedparam.SqlParameterSource

Copyright © 2018 www.massapicom. 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.