Skip to content

Conversation

jeffgbutler
Copy link
Member

This PR changes all the provider classes into interfaces to that another class could act as a decorator and make changes before the SQL is executed.

The test shows how to create a paging query using a decorator.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 55f0d28 on jeffgbutler:master into d886a6b on mybatis:master.

@jeffgbutler jeffgbutler added this to the 1.0.1 milestone Mar 15, 2018
@jeffgbutler jeffgbutler merged commit e10414c into mybatis:master Mar 15, 2018
@tnicolas29200
Copy link

Thank you for this PR, if it does what i think, it's very interessing.

Can you decorate also the selected fields ? (It is necessary to implement proprietary functions of each SQL server for example)

@jeffgbutler
Copy link
Member Author

Yes, it's possible but I think it would be better to implement those functions so the SQL is generated correctly to start. Otherwise you will have to parse the generated SQL which can be difficult.

The main motivation for this enhancement was to support paging queries - which usually just involves appending something to the end of the generated SQL.

But you do have the option now to handle it any way that seems best to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants