Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.SqlParameterValue


    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = (String) paramNames.get(i);
      try {
        Object value = paramSource.getValue(paramName);
        SqlParameter param = findParameter(declaredParams, paramName, i);
        paramArray[i] = (param != null ? new SqlParameterValue(param, value) : value);
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(
            "No value supplied for the SQL parameter '" + paramName + "': " + ex.getMessage());
      }
View Full Code Here


    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = (String) paramNames.get(i);
      try {
        Object value = paramSource.getValue(paramName);
        SqlParameter param = findParameter(declaredParams, paramName, i);
        paramArray[i] = (param != null ? new SqlParameterValue(param, value) : value);
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(
            "No value supplied for the SQL parameter '" + paramName + "': " + ex.getMessage());
      }
View Full Code Here

   * @return the value object
   */
  public static Object getTypedValue(SqlParameterSource source, String parameterName) {
    int sqlType = source.getSqlType(parameterName);
    if (sqlType != SqlParameterSource.TYPE_UNKNOWN) {
      return new SqlParameterValue(sqlType, source.getValue(parameterName));
    }
    else {
      return source.getValue(parameterName);
    }
  }
View Full Code Here

    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = paramNames.get(i);
      try {
        Object value = paramSource.getValue(paramName);
        SqlParameter param = findParameter(declaredParams, paramName, i);
        paramArray[i] = (param != null ? new SqlParameterValue(param, value) : value);
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(
            "No value supplied for the SQL parameter '" + paramName + "': " + ex.getMessage());
      }
View Full Code Here

   */
  public static Object getTypedValue(SqlParameterSource source, String parameterName) {
    int sqlType = source.getSqlType(parameterName);
    if (sqlType != SqlParameterSource.TYPE_UNKNOWN) {
      if (source.getTypeName(parameterName) != null) {
        return new SqlParameterValue(sqlType, source.getTypeName(parameterName), source.getValue(parameterName));
      }
      else {
        return new SqlParameterValue(sqlType, source.getValue(parameterName));
      }
    }
    else {
      return source.getValue(parameterName);
    }
View Full Code Here

    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = (String) paramNames.get(i);
      try {
        Object value = paramSource.getValue(paramName);
        SqlParameter param = findParameter(declaredParams, paramName, i);
        paramArray[i] = (param != null ? new SqlParameterValue(param, value) : value);
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(
            "No value supplied for the SQL parameter '" + paramName + "': " + ex.getMessage());
      }
View Full Code Here

   */
  public static Object getTypedValue(SqlParameterSource source, String parameterName) {
    int sqlType = source.getSqlType(parameterName);
    if (sqlType != SqlParameterSource.TYPE_UNKNOWN) {
      if (source.getTypeName(parameterName) != null) {
        return new SqlParameterValue(sqlType, source.getTypeName(parameterName), source.getValue(parameterName));
      }
      else {
        return new SqlParameterValue(sqlType, source.getValue(parameterName));
      }
    }
    else {
      return source.getValue(parameterName);
    }
View Full Code Here

  private void doSetStatementParameters(Object[] values, PreparedStatement ps, int[] columnTypes) throws SQLException {
    int colIndex = 0;
    for (Object value : values) {
      colIndex++;
      if (value instanceof SqlParameterValue) {
        SqlParameterValue paramValue = (SqlParameterValue) value;
        StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue());
      }
      else {
        int colType;
        if (columnTypes == null || columnTypes.length < colIndex) {
          colType = SqlTypeValue.TYPE_UNKNOWN;
View Full Code Here

    for (int i = 0; i < paramNames.size(); i++) {
      String paramName = (String) paramNames.get(i);
      try {
        Object value = paramSource.getValue(paramName);
        SqlParameter param = findParameter(declaredParams, paramName, i);
        paramArray[i] = (param != null ? new SqlParameterValue(param, value) : value);
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(
            "No value supplied for the SQL parameter '" + paramName + "': " + ex.getMessage());
      }
View Full Code Here

    replay();

    NamedParameterJdbcTemplate jt = new NamedParameterJdbcTemplate(mockDataSource);
    Map params = new HashMap();
    params.put("perfId", new SqlParameterValue(Types.DECIMAL, new Integer(1)));
    params.put("priceId", new SqlParameterValue(Types.INTEGER, new Integer(1)));
    assertEquals("result", jt.execute(UPDATE_NAMED_PARAMETERS, params, new PreparedStatementCallback() {
      public Object doInPreparedStatement(PreparedStatement ps) throws SQLException {
        assertEquals(mockPreparedStatement, ps);
        ps.executeUpdate();
        return "result";
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.core.SqlParameterValue

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.