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

Fix missing head string in fingerprint of an unexpected CALL statement #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 query/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ func Fingerprint(q string) string {
if Debug {
fmt.Println("CALL sp_name")
}
return "call " + q[cpFromOffset:qi]
return string(f[0:fi]) + q[cpFromOffset:qi]
} else if sqlState != onDupeKeyUpdate && (((s == inSpace || s == moreValuesOrUnknown) && (prevWord == "value" || prevWord == "values" || prevWord == "in")) || wordIn(q[cpFromOffset:qi], "value", "values", "in")) {
// VALUE(, VALUE (, VALUES(, VALUES (, IN(, or IN(
// but not after ON DUPLICATE KEY UPDATE
Expand Down
11 changes: 11 additions & 0 deletions query/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,14 @@ func TestFingerprintWithNumberInDbName(t *testing.T) {
query.Fingerprint(q),
)
}

func TestFingerprintUnexpected(t *testing.T) {
var q string

q = "EXPLAIN CALL foo(1, 2, 3)"
assert.Equal(
t,
"explain call foo",
query.Fingerprint(q),
)
}