MCPcopy Index your code
hub / github.com/bytebase/bytebase / hasMultipleStatements

Function hasMultipleStatements

backend/api/v1/sql_service.go:503–515  ·  view source on GitHub ↗

hasMultipleStatements reports whether a batch has more than one non-empty statement. Multi-statement batches can change the session's default schema mid-batch (e.g. Postgres `SET search_path`), so DML/DDL in them falls back to the database-level check. SUP-222.

(statements []parserbase.Statement)

Source from the content-addressed store, hash-verified

501// Multi-statement batches can change the session's default schema mid-batch (e.g. Postgres
502// `SET search_path`), so DML/DDL in them falls back to the database-level check. SUP-222.
503func hasMultipleStatements(statements []parserbase.Statement) bool {
504 n := 0
505 for _, st := range statements {
506 if st.Empty {
507 continue
508 }
509 n++
510 if n > 1 {
511 return true
512 }
513 }
514 return false
515}
516
517func extractSourceTable(comment string) (string, string, string, error) {
518 pattern := `\((\w+),\s*(\w+)(?:,\s*(\w+))?\)`

Callers 2

queryRetryStopOnErrorFunction · 0.85
doExportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected