Ejemplo n.º 1
0
 /**
  * Add parameter, and replace if exist
  *
  * @param columnName
  * @param value
  */
 private void setSqlValue(String columnName, Object value) {
   // We deal about null values later
   if (value == null) return;
   // Lets find a sqlParam type
   final CallParam cp = PARAM_MAP.get(columnName);
   if (cp == null) {
     throw new IllegalArgumentException("could not add unknown column " + columnName);
   }
   sqlParamsMap.put(columnName, value);
 }
Ejemplo n.º 2
0
    /**
     * Get the sql param
     *
     * @param columnName
     * @return sqlParam value
     */
    private SQLParam getSqlParam(String columnName) {

      // Lets find a sqlParam type
      final CallParam cp = PARAM_MAP.get(columnName);
      if (cp == null) {
        throw new IllegalArgumentException("could not get param for unknown column " + columnName);
      }
      // Check the old value exist
      final Object value = sqlParamsMap.get(columnName);
      if (value == null) {
        return null;
      }

      final int sqlType = cp.sqlType;
      return new SQLParam(columnName, value, sqlType);
    }