public void testLimitOnly() throws Exception { String expected = "select * from emp order by emp.id limit 10"; H2PagingTransformer transformer = new H2PagingTransformer(-1, 10); SqlParser parser = new SqlParser("select * from emp order by emp.id"); SqlNode sqlNode = transformer.transform(parser.parse()); NodePreparedSqlBuilder sqlBuilder = new NodePreparedSqlBuilder(new MockConfig(), SqlKind.SELECT, "dummyPath"); PreparedSql sql = sqlBuilder.build(sqlNode); assertEquals(expected, sql.getRawSql()); }
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); }