Skip to content

Commit

Permalink
parser: add autoid cache option (#765)
Browse files Browse the repository at this point in the history
  • Loading branch information
AilinKid authored Apr 10, 2020
1 parent d0cec01 commit 81f3db8
Show file tree
Hide file tree
Showing 7 changed files with 7,961 additions and 7,927 deletions.
5 changes: 5 additions & 0 deletions ast/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,7 @@ const (
TableOptionEngine
TableOptionCharset
TableOptionCollate
TableOptionAutoIdCache
TableOptionAutoIncrement
TableOptionComment
TableOptionAvgRowLength
Expand Down Expand Up @@ -1837,6 +1838,10 @@ func (n *TableOption) Restore(ctx *format.RestoreCtx) error {
ctx.WriteKeyWord("AUTO_INCREMENT ")
ctx.WritePlain("= ")
ctx.WritePlainf("%d", n.UintValue)
case TableOptionAutoIdCache:
ctx.WriteKeyWord("AUTO_ID_CACHE ")
ctx.WritePlain("= ")
ctx.WritePlainf("%d", n.UintValue)
case TableOptionComment:
ctx.WriteKeyWord("COMMENT ")
ctx.WritePlain("= ")
Expand Down
1 change: 1 addition & 0 deletions misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ var tokenMap = map[string]int{
"ASC": asc,
"ASCII": ascii,
"AUTO_INCREMENT": autoIncrement,
"AUTO_ID_CACHE": autoIdCache,
"AUTO_RANDOM": autoRandom,
"AVG_ROW_LENGTH": avgRowLength,
"AVG": avg,
Expand Down
2 changes: 2 additions & 0 deletions model/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const (
ActionDropSequence ActionType = 36
ActionAddColumns ActionType = 37
ActionDropColumns ActionType = 38
ActionModifyTableAutoIdCache ActionType = 39
)

const (
Expand Down Expand Up @@ -115,6 +116,7 @@ var actionMap = map[ActionType]string{
ActionDropSequence: "drop sequence",
ActionAddColumns: "add multi-columns",
ActionDropColumns: "drop multi-columns",
ActionModifyTableAutoIdCache: "modify auto id cache",
}

// String return current ddl action in string
Expand Down
1 change: 1 addition & 0 deletions model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ type TableInfo struct {
PKIsHandle bool `json:"pk_is_handle"`
Comment string `json:"comment"`
AutoIncID int64 `json:"auto_inc_id"`
AutoIdCache int64 `json:"auto_id_cache"`
MaxColumnID int64 `json:"max_col_id"`
MaxIndexID int64 `json:"max_idx_id"`
// UpdateTS is used to record the timestamp of updating the table's schema information.
Expand Down
Loading

0 comments on commit 81f3db8

Please sign in to comment.