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

Parser: Support SQL_BIG_RESULT, SQL_SMALL_RESULT, SQL_BUFFER_RESULT #304

Merged
merged 10 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ast/dml.go
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,18 @@ func (n *SelectStmt) Restore(ctx *RestoreCtx) error {
ctx.WritePlain(" ")
}

if n.SelectStmtOpts.SQLSmallResult {
ctx.WriteKeyWord("SQL_SMALL_RESULT ")
}

if n.SelectStmtOpts.SQLBigResult {
ctx.WriteKeyWord("SQL_BIG_RESULT ")
}

if n.SelectStmtOpts.SQLBufferResult {
ctx.WriteKeyWord("SQL_BUFFER_RESULT ")
}

if !n.SelectStmtOpts.SQLCache {
ctx.WriteKeyWord("SQL_NO_CACHE ")
}
Expand Down
15 changes: 9 additions & 6 deletions ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1974,12 +1974,15 @@ func (i Ident) String() string {

// SelectStmtOpts wrap around select hints and switches
type SelectStmtOpts struct {
Distinct bool
SQLCache bool
CalcFoundRows bool
StraightJoin bool
Priority mysql.PriorityEnum
TableHints []*TableOptimizerHint
Distinct bool
SQLBigResult bool
SQLBufferResult bool
SQLCache bool
SQLSmallResult bool
CalcFoundRows bool
StraightJoin bool
Priority mysql.PriorityEnum
TableHints []*TableOptimizerHint
}

// TableOptimizerHint is Table level optimizer hint
Expand Down
3 changes: 3 additions & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,12 @@ var tokenMap = map[string]int{
"SOME": some,
"SPLIT": split,
"SQL": sql,
"SQL_BIG_RESULT": sqlBigResult,
"SQL_BUFFER_RESULT": sqlBufferResult,
"SQL_CACHE": sqlCache,
"SQL_CALC_FOUND_ROWS": sqlCalcFoundRows,
"SQL_NO_CACHE": sqlNoCache,
"SQL_SMALL_RESULT": sqlSmallResult,
"SOURCE": source,
"SSL": ssl,
"START": start,
Expand Down
Loading