Search in sources :

Example 1 with SqlSourceBuilder

use of org.apache.ibatis.builder.SqlSourceBuilder in project mybatis-3 by mybatis.

the class DynamicSqlSource method getBoundSql.

@Override
public BoundSql getBoundSql(Object parameterObject) {
    DynamicContext context = new DynamicContext(configuration, parameterObject);
    rootSqlNode.apply(context);
    SqlSourceBuilder sqlSourceParser = new SqlSourceBuilder(configuration);
    Class<?> parameterType = parameterObject == null ? Object.class : parameterObject.getClass();
    SqlSource sqlSource = sqlSourceParser.parse(context.getSql(), parameterType, context.getBindings());
    BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
    for (Map.Entry<String, Object> entry : context.getBindings().entrySet()) {
        boundSql.setAdditionalParameter(entry.getKey(), entry.getValue());
    }
    return boundSql;
}
Also used : SqlSource(org.apache.ibatis.mapping.SqlSource) BoundSql(org.apache.ibatis.mapping.BoundSql) SqlSourceBuilder(org.apache.ibatis.builder.SqlSourceBuilder) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 SqlSourceBuilder (org.apache.ibatis.builder.SqlSourceBuilder)1 BoundSql (org.apache.ibatis.mapping.BoundSql)1 SqlSource (org.apache.ibatis.mapping.SqlSource)1