MCPcopy Create free account
hub / github.com/bytebase/bytebase / isAllDMLImpl

Function isAllDMLImpl

backend/plugin/parser/base/interface.go:343–368  ·  view source on GitHub ↗
(engine storepb.Engine, statement string)

Source from the content-addressed store, hash-verified

341}
342
343func isAllDMLImpl(engine storepb.Engine, statement string) bool {
344 stmts, err := ParseStatements(engine, statement)
345 if err != nil {
346 return false
347 }
348 asts := ExtractASTs(stmts)
349 if len(asts) == 0 {
350 return false
351 }
352 types, err := GetStatementTypes(engine, asts)
353 if err != nil {
354 return false
355 }
356 if len(types) == 0 {
357 return false
358 }
359 for _, t := range types {
360 switch t {
361 case storepb.StatementType_INSERT, storepb.StatementType_UPDATE, storepb.StatementType_DELETE:
362 // DML statement, continue
363 default:
364 return false
365 }
366 }
367 return true
368}
369
370type ChangeSummary struct {
371 ChangedResources *model.ChangedResources

Callers 1

IsAllDMLFunction · 0.85

Calls 3

ParseStatementsFunction · 0.85
ExtractASTsFunction · 0.85
GetStatementTypesFunction · 0.70

Tested by

no test coverage detected