Skip to content

Commit

Permalink
add test case to cover quoted identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zhengda committed Oct 10, 2023
1 parent 046f310 commit 38637fa
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions obfuscate_and_normalize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,31 @@ multiline comment */
Size: 12,
},
},
{
// double quoted table name
input: `SELECT * FROM "public"."users" WHERE id = 1`,
expected: `SELECT * FROM "public"."users" WHERE id = ?`,
statementMetadata: StatementMetadata{
Tables: []string{`"public"."users"`},
Comments: []string{},
Commands: []string{"SELECT"},
Size: 22,
},
},
{
// [] quoted table name
input: `SELECT * FROM [public].[users] WHERE id = 1`,
expected: `SELECT * FROM [public].[users] WHERE id = ?`,
statementMetadata: StatementMetadata{
Tables: []string{"[public].[users]"},
Comments: []string{},
Commands: []string{"SELECT"},
Size: 22,
},
lexerOpts: []lexerOption{
WithDBMS(DBMSSQLServer),
},
},
}

obfuscator := NewObfuscator(
Expand Down

0 comments on commit 38637fa

Please sign in to comment.