Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Support /**/ style comment in driver util function ApplyMultiStatements.
spinningbot76250cdce34a
diff --git a/plugin/db/util/driverutil.go b/plugin/db/util/driverutil.goindex 4edb866468..2c4e256cde 100644--- a/plugin/db/util/driverutil.go+++ b/plugin/db/util/driverutil.go@@ -26,11 +26,30 @@ func FormatErrorWithQuery(err error, query string) error {func ApplyMultiStatements(sc *bufio.Scanner, f func(string) error) error {s := ""delimiter := false+ comment := falsefor sc.Scan() {line := sc.Text()execute := falseswitch {+ case strings.HasPrefix(line, "/*"):+ if strings.Contains(line, "*/") {+ if !strings.HasSuffix(line, "*/") {+ return fmt.Errorf("`*/` must be the end of the line; new statement should start as a new line")+ }+ } else {+ comment = true+ }+ continue+ case comment && !strings.Contains(line, "*/"):+ // Skip the line when in comment mode.+ continue+ case comment && strings.Contains(line, "*/"):+ if !strings.HasSuffix(line, "*/") {+ return fmt.Errorf("`*/` must be the end of the line; new statement should start as a new line")+ }+ comment = false+ continuecase s == "" && line == "":continuecase strings.HasPrefix(line, "--"):