Skip to content

Commit

Permalink
upper case collected commands
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zhengda committed Dec 17, 2024
1 parent 90812ab commit c6d44ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion normalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func (n *Normalizer) collectMetadata(token *Token, lastToken *Token, statementMe
}
if n.config.CollectCommands && isCommand(tokenVal) {
// Collect commands
statementMetadata.Commands = append(statementMetadata.Commands, tokenVal)
statementMetadata.Commands = append(statementMetadata.Commands, strings.ToUpper(tokenVal))
} else if isWith(lastToken.Value) && token.Type == IDENT {
// Collect CTEs so we can skip them later in table collection
ctes[tokenVal] = true
Expand Down
2 changes: 1 addition & 1 deletion normalizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ multiline comment */
statementMetadata: StatementMetadata{
Tables: []string{"users", "test_users", "user?"},
Comments: []string{},
Commands: []string{"CREATE", "BEGIN", "SELECT", "Update", "Delete"},
Commands: []string{"CREATE", "BEGIN", "SELECT", "UPDATE", "DELETE"},
Procedures: []string{},
Size: 49,
},
Expand Down
6 changes: 3 additions & 3 deletions obfuscate_and_normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ multiline comment */
statementMetadata: StatementMetadata{
Tables: []string{"v$sql"},
Comments: []string{},
Commands: []string{"select"},
Commands: []string{"SELECT"},
Procedures: []string{},
Size: 11,
},
Expand Down Expand Up @@ -163,7 +163,7 @@ multiline comment */
statementMetadata: StatementMetadata{
Tables: []string{},
Comments: []string{},
Commands: []string{"begin", "execute"},
Commands: []string{"BEGIN", "EXECUTE"},
Procedures: []string{},
Size: 12,
},
Expand Down Expand Up @@ -234,7 +234,7 @@ multiline comment */
statementMetadata: StatementMetadata{
Tables: []string{`public.users`},
Comments: []string{},
Commands: []string{"select"},
Commands: []string{"SELECT"},
Procedures: []string{},
Size: 18,
},
Expand Down

0 comments on commit c6d44ad

Please sign in to comment.