Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LIMIT and OFFSET on SQL builder class #1521

Merged
merged 2 commits into from
Jun 16, 2019

Conversation

kazuki43zoo
Copy link
Member

Fixes gh-1518

@kazuki43zoo
Copy link
Member Author

I've fixed gh-1518.

  • Supports the LIMIT on select/update/delete
  • Supports the OFFSET on select

WDYT?

@kazuki43zoo kazuki43zoo self-assigned this Apr 14, 2019
@kazuki43zoo kazuki43zoo added the enhancement Improve a feature or add a new feature label Apr 14, 2019
Copy link
Contributor

@kezhenxu94 kezhenxu94 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Useful feature 👍

@harawata
Copy link
Member

@jeffgbutler ,
You recently added LIMIT/OFFSET support to dynamic-sql.
Are you OK with this, too?

@jeffgbutler
Copy link
Member

I am OK with this.

I tried to make clear in the dynamic-sql documentation that this isn’t a “magic” method meaning that it won’t translate to something else for databases that don’t support limit and offset. But most databases do support it now so the caution is mainly for Oracle users :)

@harawata
Copy link
Member

Thank you, @jeffgbutler !

I just checked and ANSI SQL chose FETCH FIRST as the default syntax, it seems.
https://en.wikipedia.org/wiki/Select_(SQL)#FETCH_FIRST_clause
And popular DBs started supporting this syntax.

Anyway, I agree that LIMIT/OFFSET still is a popular syntax, so I also have no objection.
@kazuki43zoo Your call. :)

@kazuki43zoo
Copy link
Member Author

@harawata @jeffgbutler @kezhenxu94 Thanks for your review!

I will merge this PR after updating documentation(plant to includes the note that same as mybatis-synamic-sql). And I consider to support "FETCH FIRST" clause by another issue.

Thank you again!

@kazuki43zoo kazuki43zoo added this to the 3.5.2 milestone Jun 16, 2019
@kazuki43zoo kazuki43zoo merged commit 528d923 into mybatis:master Jun 16, 2019
@kazuki43zoo kazuki43zoo deleted the gh-1518 branch June 16, 2019 02:58
@kazuki43zoo kazuki43zoo changed the title Support LIMIT and OFFSET on SQL class Support LIMIT and OFFSET on SQL builder class Jul 3, 2019
pulllock pushed a commit to pulllock/mybatis-3 that referenced this pull request Oct 19, 2023
Support LIMIT and OFFSET on SQL class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve a feature or add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL can`t use LIMIT AND OFFSET
4 participants