MCPcopy Create free account
hub / github.com/alexisvisco/amigo / execSQLDB

Method execSQLDB

sql_migration.go:64–77  ·  view source on GitHub ↗

execSQLDB executes SQL on a DB, either as a single exec or split by statements

(ctx context.Context, db *sql.DB, query string)

Source from the content-addressed store, hash-verified

62
63// execSQLDB executes SQL on a DB, either as a single exec or split by statements
64func (s SQLMigration) execSQLDB(ctx context.Context, db *sql.DB, query string) error {
65 if !s.splitStatements {
66 _, err := db.ExecContext(ctx, query)
67 return err
68 }
69
70 statements := splitSQLStatementsWithAnnotations(query)
71 for _, stmt := range statements {
72 if _, err := db.ExecContext(ctx, stmt); err != nil {
73 return err
74 }
75 }
76 return nil
77}
78
79func (s SQLMigration) Name() string {
80 return s.name

Callers 2

UpMethod · 0.95
DownMethod · 0.95

Calls 2

ExecContextMethod · 0.45

Tested by

no test coverage detected