Skip to content

Commit 398c968

Browse files
committed
#64 - Add workaround for pagination.
In place until we migrate to Spring Data Relational dialects.
1 parent ce6a3c5 commit 398c968

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/main/java/org/springframework/data/r2dbc/function/DefaultStatementFactory.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.springframework.data.r2dbc.domain.SettableValue;
3939
import org.springframework.data.r2dbc.function.operation.Bindings;
4040
import org.springframework.data.r2dbc.function.operation.PreparedOperation;
41+
import org.springframework.data.r2dbc.support.StatementRenderUtil;
4142
import org.springframework.data.relational.core.sql.AssignValue;
4243
import org.springframework.data.relational.core.sql.Assignment;
4344
import org.springframework.data.relational.core.sql.Column;
@@ -140,11 +141,13 @@ public PreparedOperation<Select> select(String tableName, Collection<String> col
140141
selectBuilder.orderBy(createOrderByFields(table, configurer.sort));
141142
}
142143

143-
configurer.limit.ifPresent(selectBuilder::limit);
144-
configurer.offset.ifPresent(selectBuilder::offset);
145-
146-
Select build = selectBuilder.build();
147-
return new DefaultPreparedOperation<>(build, renderContext, configurer.bindings);
144+
Select select = selectBuilder.build();
145+
return new DefaultPreparedOperation<Select>(select, renderContext, configurer.bindings) {
146+
@Override
147+
public String toQuery() {
148+
return StatementRenderUtil.render(select, configurer.limit, configurer.offset, dialect);
149+
}
150+
};
148151
});
149152
}
150153

0 commit comments

Comments
 (0)