{@inheritDoc}

@see jp.co.future.uroborosql.fluent.SqlFluent#param(java.lang.String, java.lang.Object, int)
548281
@Override
	public SqlContext param(final String parameterName, final Object value, final int sqlType) {
		if (value instanceof Optional) {
			Optional<?> optionalValue = (Optional<?>) value;
			if (optionalValue.isPresent()) {
				param(new Parameter(parameterName, optionalValue.get(), sqlType));
			} else {
				param(new Parameter(parameterName, null));
			}
			return this;
		} else {
			return param(new Parameter(parameterName, value, sqlType));
		}
	}
172274
public int count(String sql, Object[] params) {
				
		int rowCount = 0;
		try{
			Map<String, Object> resultMap = null;
			if (params == null || params.length == 0) {
				resultMap = getProxy().queryForMap(sql);
			} else {
				resultMap = getProxy().queryForMap(sql, params);
			}
			Iterator<Map.Entry<String, Object>> it = resultMap.entrySet().iterator();
			if(it.hasNext()){
				Map.Entry<String, Object> entry = it.next();
				rowCount = ((Long)entry.getValue()).intValue();
			}
		}catch(EmptyResultDataAccessException e){
			
		}
		
		
		return rowCount;
	}
655305
private static void writeParam(Object v, DataOutput writer) throws IOException {
		if (v instanceof Byte) {
			writer.write(BYTE_ID);
			writer.writeByte(((Byte) v).byteValue());
		} else if (v instanceof Short) {
			writer.write(SHORT_ID);
			writer.writeShort(((Short) v).shortValue());
		} else if (v instanceof Integer) {
			writer.write(INTEGER_ID);
			writer.writeInt(((Integer) v).intValue());
		} else if (v instanceof Character) {
			writer.write(CHAR_ID);
			writer.writeChar(((Character) v).charValue());
		} else if (v instanceof Long) {
			writer.write(LONG_ID);
			writer.writeLong(((Long) v).longValue());
		} else if (v instanceof Float) {
			writer.write(FLOAT_ID);
			writer.writeFloat(((Float) v).floatValue());
		} else if (v instanceof Double) {
			writer.write(DOUBLE_ID);
			writer.writeDouble(((Double) v).doubleValue());
		} else if (v instanceof Date) {
			writer.write(DATE_ID);
			writer.writeLong(((Date) v).getTime());
		} else if (v != null) {
			writer.write(STRING_ID);
			writeString(v.toString(), writer);
		} else {
			writer.write(NULL_ID);
		}
	}
720455
@Override
    public Object apply(Object value, Object... params) {

        if (value == null) {
            return "";
        }

        List<Object> list = new ArrayList<Object>();

        Object[] array = super.asArray(value);

        String key = super.asString(super.get(0, params));

        for (Object obj : array) {

            java.util.Map map = (java.util.Map) obj;

            Object val = map.get(key);

            if (val != null) {
                list.add(val);
            }
        }

        return list.toArray(new Object[list.size()]);
    }
702063
protected int setInParameter(final PreparedStatement preparedStatement, final int index,
			final BindParameterMapperManager parameterMapperManager) throws SQLException {
		int parameterIndex = index;
		if (value instanceof List) {
			for (Object e : (List<?>) value) {
				setParameterObject(preparedStatement, parameterIndex, e, parameterMapperManager);

				parameterLog(parameterIndex);
				parameterIndex++;
			}
		} else {
			setParameterObject(preparedStatement, parameterIndex, value, parameterMapperManager);

			parameterLog(parameterIndex);
			parameterIndex++;
		}

		return parameterIndex;
	}
729689
@Override
	public Parameter doParameter(final Parameter parameter) {
		if (getFilters().isEmpty()) {
			return parameter;
		}
		Parameter param = parameter;
		for (final SqlFilter filter : getFilters()) {
			param = filter.doParameter(param);
		}
		return param;
	}
805322
@SuppressWarnings("rawtypes")
	protected StatementParameter toStatementParameter(String sql, Object... params) {
		StatementParameter param = new StatementParameter();
		for (Object p : params) {
			if (p instanceof Integer) {
				param.setInt((Integer) p);
			}
			else if (p instanceof Long) {
				param.setLong((Long) p);
			}
			else if (p instanceof Boolean) {
				param.setBool((Boolean) p);
			}
			else if (p instanceof Float) {
				param.setFloat((Float) p);
			}
			else if (p instanceof Double) {
				param.setDouble((Double) p);
			}
			else if (p instanceof String) {
				param.setString((String) p);
			}
			else if (p instanceof Date) {
				param.setDate((Date) p);
			}

			else if (p instanceof List) {
				param.setList((List) p);
			}
			// 自定义数据类型start
			// else if (p instanceof OnlyDate) {
			// param.setDate(((OnlyDate) p).toDate());
			// }
			// else if (p instanceof Month) {
			// param.setString(((Month) p).toString());
			// }
			else {
				param.setObject(p);
				// throw new IllegalArgumentException("未知数据类型[" + p.getClass().getName() + "].");
			}
		}
		return param;
	}
1047928
public int execute(String sql, Object... params) {
        Connection conn = getConn();
        try {
            return conn.createQuery(sql)
                    .withParams(params)
                    .executeUpdate()
                    .getResult();
        } finally {
            this.closeConn(conn);
            this.clean(conn);
        }
    }
49198
@Override
	public Parameter doParameter(final Parameter parameter) {
		if (skipFilter || parameter == null) {
			return parameter;
		}

		if (Parameter.class.equals(parameter.getClass())) {
			// 通常のパラメータの場合
			String key = parameter.getParameterName();
			if (getCryptParamKeys().contains(CaseFormat.CAMEL_CASE.convert(key))) {
				Object obj = parameter.getValue();
				if (obj != null && obj instanceof String) {
					String objStr = obj.toString();
					if (StringUtils.isNotEmpty(objStr)) {
						try {
							synchronized (encryptCipher) {
								return new Parameter(key, encrypt(encryptCipher, secretKey, objStr));
							}
						} catch (Exception ex) {
							return parameter;
						}
					}
				}
			}
		}

		return parameter;
	}
897333
@Override
    public void setInt(int parameterIndex, int x) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        this.parameters[parameterIndex-1] = x;
    }
669698
public void setQueryParams(Collection queryParams, PreparedStatement ps) throws Exception {
		if ((queryParams == null) || (queryParams.size() == 0))
			return;
		int i = 1;
		Object key = null;

		Iterator iter = queryParams.iterator();
		while (iter.hasNext()) {
			key = iter.next();
			if (key != null) {
				convertType(i, key, ps);
				Debug.logVerbose("[JdonFramework] parameter " + i + " = " + key.toString(), module);
			} else {
				Debug.logWarning("[JdonFramework] parameter " + i + " is null", module);
				ps.setString(i, "");
			}
			i++;
		}

	}
151706
@Override
    public void setDate(int parameterIndex, Date x) throws SQLException {
        internalStmt.setDate(parameterIndex, x);
    }
318214
@SuppressWarnings("unchecked")
    public <N> List<N> findOneColumn(String sql, List<?> params, final int mapperColumnIndex,
                                     final Class<N> resultClass) {

        if (sql == null) {
            recordLog(" param sql is null!");
        }

        if (Number.class.isAssignableFrom(resultClass)) {
            if (resultClass.equals(Long.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Long.valueOf(n.longValue());
                    }
                });
            } else if (resultClass.equals(Integer.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Integer.valueOf(n.intValue());
                    }
                });
            } else if (resultClass.equals(Float.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Float.valueOf(n.floatValue());
                    }
                });
            } else if (resultClass.equals(Double.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Double.valueOf(n.doubleValue());
                    }
                });
            } else if (resultClass.equals(Short.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Short.valueOf(n.shortValue());
                    }
                });
            } else if (resultClass.equals(Byte.class)) {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        if (n == null) {
                            return null;
                        }
                        return (N) Byte.valueOf(n.byteValue());
                    }
                });
            } else {
                return findBySQL(sql, params, new RowMapper<N>() {
                    public N mapRow(ResultSet rs, int count) throws SQLException {
                        Number n = (Number) (rs.getObject(mapperColumnIndex));
                        return (N) n;
                    }
                });
            }
        } else if (resultClass.equals(String.class)) {
            return findBySQL(sql, params, new RowMapper<N>() {
                public N mapRow(ResultSet rs, int count) throws SQLException {
                    return (N) (rs.getString(mapperColumnIndex));
                }
            });
        } else if (resultClass.equals(Date.class)) {
            return findBySQL(sql, params, new RowMapper<N>() {
                public N mapRow(ResultSet rs, int count) throws SQLException {
                    return (N) (rs.getDate(mapperColumnIndex));
                }
            });
        } else {
            throw new RuntimeException("not supported type");
        }
    }
163176
@Override
	public SqlContext blobParam(final String parameterName, final InputStream value) {
		return param(new StreamParameter(parameterName, value));
	}
952974
public void setObject(final int parameterIndex, 
                          final Object x) throws SQLException {

        if (x == null) {
            if ("true".equals(connection.getProperties().
                              get("acolyte.parameter.untypedNull"))) {

                // Fallback to String-VARCHAR
                setObject(parameterIndex, null, Types.VARCHAR);

                return;
            } // end of if

            throw new SQLException("Cannot set parameter from null object");
        } // end of if

        // ---

        final String className = normalizeClassName(x.getClass());

        if (!Defaults.jdbcTypeClasses.containsKey(className)) {
            throw new SQLFeatureNotSupportedException("Unsupported parameter type: " + className);
        } // end of if
        
        // ---

        final int sqlType = Defaults.jdbcTypeClasses.get(className);

        setObject(parameterIndex, x, sqlType);
    }
1254555
public static void setSqlParams(final SqlContext ctx, final String... paramsArray) {
		Set<String> bindParams = getSqlParams(ctx.getSql());

		for (String element : paramsArray) {
			String[] param = element.split("=");
			String key = param[0];
			if (bindParams.remove(key)) {
				// キーがバインドパラメータに存在するときは値を設定する
				if (param.length == 1) {
					// キーだけの指定は値をnullと扱う
					ctx.param(key, null);
				} else {
					String val = param[1];
					setParam(ctx, key, val);
				}
			}
		}

		// 指定がなかったキーについてはnullを設定する
		bindParams.forEach(s -> ctx.param(s, null));
	}
1281272
@SuppressWarnings("unchecked")
	@Override
	public T clobParam(final String paramName, final Reader value, final int len) {
		context().clobParam(paramName, value, len);
		return (T) this;
	}