MCPcopy Create free account
hub / github.com/actiontech/dtle / ShowCreateSchema

Function ShowCreateSchema

driver/mysql/sql/sqlutils.go:324–335  ·  view source on GitHub ↗
(ctx context.Context, db QueryAble, dbName string)

Source from the content-addressed store, hash-verified

322}
323
324func ShowCreateSchema(ctx context.Context, db QueryAble, dbName string) (r string, err error) {
325 query := fmt.Sprintf("SHOW CREATE SCHEMA IF NOT EXISTS %s", mysqlconfig.EscapeName(dbName))
326 g.Logger.Debug("ShowCreateSchema", "query", query)
327 row := db.QueryRowContext(ctx, query)
328 var dummy interface{}
329 // | Database | Create Database |
330 err = row.Scan(&dummy, &r)
331 if err != nil {
332 return "", errors.Wrap(err, "ShowCreateSchema")
333 }
334 return r, nil
335}
336
337func ShowTables(db QueryAble, dbName string, showType bool) (tables []*common.Table, err error) {
338 // Get table list

Callers 1

inspectTablesMethod · 0.92

Calls 3

EscapeNameFunction · 0.92
QueryRowContextMethod · 0.80
ScanMethod · 0.80

Tested by

no test coverage detected