Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use exact match for QID #31

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ var multiLineCommentPattern = regexp.MustCompile(`\/\*(.*)\*/\s*`)
var oneLineCommentPattern = regexp.MustCompile(`(^\-\-[^\n]+|\s--[^\n]+)`)
var getTableNamePattern = regexp.MustCompile(`(?i)\s+(?:from|join)\s+([\w.]+)`)
var dualPattern = regexp.MustCompile(`from dual`)
var qIDPattern = regexp.MustCompile(`[0-9a-f-]{36}`)
var qIDPattern = regexp.MustCompile(`^[0-9a-f-]{36}$`)

// GetTableNamesInQuery is a pessimistic function to return tables involved in query in format of DB.TABLE
// https://regoio.herokuapp.com/
Expand Down
1 change: 1 addition & 0 deletions go/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func TestUilts_GetCost(t *testing.T) {
}

func TestUtils_IsQID(t *testing.T) {
assert.False(t, IsQID(`select "a44f8e61-4cbb-429a-b7ab-bea2c4a5caed"`))
assert.True(t, IsQID("a44f8e61-4cbb-429a-b7ab-bea2c4a5caed"))
assert.False(t, IsQID("a44f8e61-4cbb-429a-b7ab-bea2c4a5caeD"))
assert.False(t, IsQID("a44f8e61"))
Expand Down