use of org.seasar.doma.internal.expr.Value in project doma by domaframework.
the class SqlProcessorQuery method addParameter.
public void addParameter(String name, Class<?> type, Object value) {
assertNotNull(name, type);
parameters.put(name, new Value(type, value));
}
use of org.seasar.doma.internal.expr.Value in project doma by domaframework.
the class SqlBatchModifyQuery method addParameter.
public void addParameter(String name, Class<?> type, List<?> values) {
assertNotNull(name, type);
assertNotNull(values);
List<Value> valueList = new ArrayList<>();
for (Object value : values) {
valueList.add(new Value(type, value));
}
if (parameterSize == -1) {
parameterSize = valueList.size();
} else {
assertEquals(parameterSize, valueList.size());
}
parameters.put(name, valueList);
}
use of org.seasar.doma.internal.expr.Value in project doma by domaframework.
the class AbstractSelectQuery method addParameter.
public void addParameter(String name, Class<?> type, Object value) {
assertNotNull(name, type);
parameters.put(name, new Value(type, value));
}
use of org.seasar.doma.internal.expr.Value in project doma by domaframework.
the class SqlBatchModifyQuery method prepareSql.
protected void prepareSql() {
sqls = new ArrayList<>();
IntStream.rangeClosed(0, parameterSize - 1).forEach(i -> {
@SuppressWarnings("serial") Map<String, Value> map = new LinkedHashMap<String, Value>() {
{
parameters.forEach((key, value) -> put(key, value.get(i)));
}
};
ExpressionEvaluator evaluator = new ExpressionEvaluator(map, config.getDialect().getExpressionFunctions(), config.getClassHelper());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(config, kind, null, evaluator, sqlLogType);
PreparedSql sql = sqlBuilder.build(sqlNode, this::comment);
sqls.add(sql);
});
}
use of org.seasar.doma.internal.expr.Value in project doma by domaframework.
the class SqlFileBatchModifyQuery method prepareSql.
protected void prepareSql() {
Value value = new Value(elementClass, currentEntity);
ExpressionEvaluator evaluator = new ExpressionEvaluator(Collections.singletonMap(parameterName, value), config.getDialect().getExpressionFunctions(), config.getClassHelper());
NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(config, kind, sqlFile.getPath(), evaluator, sqlLogType, this::expandColumns, this::populateValues);
PreparedSql sql = sqlBuilder.build(sqlFile.getSqlNode(), this::comment);
sqls.add(sql);
}
Aggregations