MCPcopy Index your code
hub / github.com/github/gh-ost / parseAlterToken

Method parseAlterToken

go/sql/parser.go:98–134  ·  view source on GitHub ↗
(alterToken string)

Source from the content-addressed store, hash-verified

96}
97
98func (atp *AlterTableParser) parseAlterToken(alterToken string) {
99 {
100 // rename
101 allStringSubmatch := renameColumnRegexp.FindAllStringSubmatch(alterToken, -1)
102 for _, submatch := range allStringSubmatch {
103 if unquoted, err := strconv.Unquote(submatch[2]); err == nil {
104 submatch[2] = unquoted
105 }
106 if unquoted, err := strconv.Unquote(submatch[3]); err == nil {
107 submatch[3] = unquoted
108 }
109 atp.columnRenameMap[submatch[2]] = submatch[3]
110 }
111 }
112 {
113 // drop
114 allStringSubmatch := dropColumnRegexp.FindAllStringSubmatch(alterToken, -1)
115 for _, submatch := range allStringSubmatch {
116 if unquoted, err := strconv.Unquote(submatch[2]); err == nil {
117 submatch[2] = unquoted
118 }
119 atp.droppedColumns[submatch[2]] = true
120 }
121 }
122 {
123 // rename table
124 if renameTableRegexp.MatchString(alterToken) {
125 atp.isRenameTable = true
126 }
127 }
128 {
129 // auto_increment
130 if autoIncrementRegexp.MatchString(alterToken) {
131 atp.isAutoIncrementDefined = true
132 }
133 }
134}
135
136func (atp *AlterTableParser) ParseAlterStatement(alterStatement string) (err error) {
137 atp.alterStatementOptions = alterStatement

Callers 1

ParseAlterStatementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected