Package org.springframework.jdbc.core.namedparam

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


   * matching named parameters specified in the SQL statement
   * @return the number of rows affected by the update
   */
  public int updateByNamedParam(Map<String, ?> paramMap) throws DataAccessException {
    validateNamedParameters(paramMap);
    ParsedSql parsedSql = getParsedSql();
    MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters());
    int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params));
    checkRowsAffected(rowsAffected);
View Full Code Here


   * @param generatedKeyHolder KeyHolder that will hold the generated keys
   * @return the number of rows affected by the update
   */
  public int updateByNamedParam(Map<String, ?> paramMap, KeyHolder generatedKeyHolder) throws DataAccessException {
    validateNamedParameters(paramMap);
    ParsedSql parsedSql = getParsedSql();
    MapSqlParameterSource paramSource = new MapSqlParameterSource(paramMap);
    String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
    Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, getDeclaredParameters());
    int rowsAffected = getJdbcTemplate().update(newPreparedStatementCreator(sqlToUse, params), generatedKeyHolder);
    checkRowsAffected(rowsAffected);
View Full Code Here

            }

            @Override
            public PreparedStatement createPreparedStatement(Connection con) throws SQLException {
                // substitute named params, see NamedParameterJdbcTemplate#getPreparedStatementCreator(String sql, SqlParameterSource paramSource)
                ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(insertSQL);
                MapSqlParameterSource paramSource = new MapSqlParameterSource();
                paramSource.addValue("id", id, Types.BIGINT);
                paramSource.addValue("data", data, Types.BLOB);
                String sqlToUse = NamedParameterUtils.substituteNamedParameters(parsedSql, paramSource);
            Object[] params = NamedParameterUtils.buildValueArray(parsedSql, paramSource, null);
View Full Code Here

      final List<Map<String, Object>> batchValues) {
    long cur = System.currentTimeMillis();
    try {
      int[] batchCount = null;
      String sql = sqlp.getValue(sqlId, sqlId);
      ParsedSql parsedSql = NamedParameterUtils.parseSqlStatement(sql);
      if (sqlTypes != null && !sqlTypes.isEmpty()) {
        MapSqlParameterSource[] batch = new MapSqlParameterSource[batchValues
            .size()];
        for (int i = 0; i < batchValues.size(); i++) {
          Map<String, Object> valueMap = batchValues.get(i);
View Full Code Here

//       
//       
//      }
//      this.rs = preparedStatement.executeQuery();
     
      ParsedSql parsedSql1 = this.getParsedSql(sql).getDelegate();
      String sqlToUse1 = NamedParameterUtils.substituteNamedParameters(parsedSql1, paramSource);
      Object[] params = NamedParameterUtils.buildValueArray(parsedSql1, paramSource, null);
      List<SqlParameter> declaredParameters = NamedParameterUtils.buildSqlParameterList(parsedSql1, paramSource);
      PreparedStatementCreatorFactory pscf = new PreparedStatementCreatorFactory(sqlToUse1, declaredParameters);
      pscf.setResultSetType( ResultSet.TYPE_FORWARD_ONLY );
View Full Code Here

TOP

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

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.