@@ -33,7 +33,8 @@ type AlterTableParser struct {
3333 droppedColumns map [string ]bool
3434 isRenameTable bool
3535
36- alterTokens []string
36+ alterStatementOptions string
37+ alterTokens []string
3738
3839 explicitSchema string
3940 explicitTable string
@@ -120,22 +121,23 @@ func (this *AlterTableParser) parseAlterToken(alterToken string) (err error) {
120121
121122func (this * AlterTableParser ) ParseAlterStatement (alterStatement string ) (err error ) {
122123
124+ this .alterStatementOptions = alterStatement
123125 for _ , alterTableRegexp := range alterTableExplicitSchemaTableRegexps {
124- if submatch := alterTableRegexp .FindStringSubmatch (alterStatement ); len (submatch ) > 0 {
126+ if submatch := alterTableRegexp .FindStringSubmatch (this . alterStatementOptions ); len (submatch ) > 0 {
125127 this .explicitSchema = submatch [1 ]
126128 this .explicitTable = submatch [2 ]
127- alterStatement = submatch [3 ]
129+ this . alterStatementOptions = submatch [3 ]
128130 break
129131 }
130132 }
131133 for _ , alterTableRegexp := range alterTableExplicitTableRegexps {
132- if submatch := alterTableRegexp .FindStringSubmatch (alterStatement ); len (submatch ) > 0 {
134+ if submatch := alterTableRegexp .FindStringSubmatch (this . alterStatementOptions ); len (submatch ) > 0 {
133135 this .explicitTable = submatch [1 ]
134- alterStatement = submatch [2 ]
136+ this . alterStatementOptions = submatch [2 ]
135137 break
136138 }
137139 }
138- alterTokens , _ := this .tokenizeAlterStatement (alterStatement )
140+ alterTokens , _ := this .tokenizeAlterStatement (this . alterStatementOptions )
139141 for _ , alterToken := range alterTokens {
140142 alterToken = this .sanitizeQuotesFromAlterStatement (alterToken )
141143 this .parseAlterToken (alterToken )
@@ -180,3 +182,7 @@ func (this *AlterTableParser) GetExplicitTable() string {
180182func (this * AlterTableParser ) HasExplicitTable () bool {
181183 return this .GetExplicitTable () != ""
182184}
185+
186+ func (this * AlterTableParser ) GetAlterStatementOptions () string {
187+ return this .alterStatementOptions
188+ }
0 commit comments