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

Method tokenizeAlterStatement

go/sql/parser.go:65–90  ·  view source on GitHub ↗
(alterStatement string)

Source from the content-addressed store, hash-verified

63}
64
65func (atp *AlterTableParser) tokenizeAlterStatement(alterStatement string) (tokens []string) {
66 terminatingQuote := rune(0)
67 f := func(c rune) bool {
68 switch {
69 case c == terminatingQuote:
70 terminatingQuote = rune(0)
71 return false
72 case terminatingQuote != rune(0):
73 return false
74 case c == '\'':
75 terminatingQuote = c
76 return false
77 case c == '(':
78 terminatingQuote = ')'
79 return false
80 default:
81 return c == ','
82 }
83 }
84
85 tokens = strings.FieldsFunc(alterStatement, f)
86 for i := range tokens {
87 tokens[i] = strings.TrimSpace(tokens[i])
88 }
89 return tokens
90}
91
92func (atp *AlterTableParser) sanitizeQuotesFromAlterStatement(alterStatement string) (strippedStatement string) {
93 strippedStatement = alterStatement

Callers 2

ParseAlterStatementMethod · 0.95

Calls

no outgoing calls

Tested by 1