diff --git a/obfuscate_and_normalize_test.go b/obfuscate_and_normalize_test.go index 0324098..6c2306c 100644 --- a/obfuscate_and_normalize_test.go +++ b/obfuscate_and_normalize_test.go @@ -411,6 +411,20 @@ multiline comment */ Size: 11, }, }, + { + input: `DELETE FROM [discount] WHERE [description]=@1`, + expected: `DELETE FROM discount WHERE description = @1`, + statementMetadata: StatementMetadata{ + Tables: []string{"discount"}, + Comments: []string{}, + Commands: []string{"DELETE"}, + Procedures: []string{}, + Size: 14, + }, + lexerOpts: []lexerOption{ + WithDBMS(DBMSSQLServer), + }, + }, } obfuscator := NewObfuscator( diff --git a/sqllexer.go b/sqllexer.go index edf2593..e504516 100644 --- a/sqllexer.go +++ b/sqllexer.go @@ -370,7 +370,7 @@ func (s *Lexer) scanWhitespace() Token { func (s *Lexer) scanOperator(lastCh rune) Token { s.start = s.cursor ch := s.next() - for isOperator(ch) && !(lastCh == '=' && ch == '?') { + for isOperator(ch) && !(lastCh == '=' && (ch == '?' || ch == '@')) { // hack: we don't want to treat "=?" as an single operator lastCh = ch ch = s.next()