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

Function ValidateSQLForEditor

backend/plugin/parser/base/interface.go:96–102  ·  view source on GitHub ↗

ValidateSQLForEditor validates the SQL statement for editor. We support the following SQLs: 1. EXPLAIN statement, except EXPLAIN ANALYZE 2. SELECT statement We also support CTE with SELECT statements, but not with DML statements. The first bool indicates whether the query can run in read-only mode,

(engine storepb.Engine, statement string)

Source from the content-addressed store, hash-verified

94// We also support CTE with SELECT statements, but not with DML statements.
95// The first bool indicates whether the query can run in read-only mode, and the second bool determines whether all queries return data.
96func ValidateSQLForEditor(engine storepb.Engine, statement string) (bool, bool, error) {
97 f, ok := queryValidators[engine]
98 if !ok {
99 return true, true, nil
100 }
101 return f(statement)
102}
103
104func RegisterExtractChangedResourcesFunc(engine storepb.Engine, f ExtractChangedResourcesFunc) {
105 mux.Lock()

Callers 12

QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92
QueryConnMethod · 0.92

Calls 1

fFunction · 0.85

Tested by 1