Skip to content

Commit 44d1535

Browse files
committed
feat: preserve optimizer hints in StripComments
1 parent 4bf2159 commit 44d1535

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

internal/source/code.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@ func StripComments(sql string) (string, []string, error) {
115115
continue
116116
}
117117
if strings.HasPrefix(t, "/*") && strings.HasSuffix(t, "*/") {
118+
if strings.HasPrefix(t, "/*+") {
119+
// Optimizer hints (/*+ ... */) must be preserved in the SQL string
120+
lines = append(lines, t)
121+
continue
122+
}
118123
t = strings.TrimPrefix(t, "/*")
119124
t = strings.TrimSuffix(t, "*/")
120125
comments = append(comments, t)

0 commit comments

Comments
 (0)