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

Function execTableDDL

backend/plugin/parser/tidb/completion.go:266–277  ·  view source on GitHub ↗
(cat *catalog.Catalog, name string, columns []*storepb.ColumnMetadata, generic bool)

Source from the content-addressed store, hash-verified

264}
265
266func execTableDDL(cat *catalog.Catalog, name string, columns []*storepb.ColumnMetadata, generic bool) bool {
267 defs := make([]string, 0, len(columns))
268 for _, col := range columns {
269 colType := col.GetType()
270 if generic || colType == "" {
271 colType = genericColumnType
272 }
273 defs = append(defs, backtickIdentifier(col.GetName())+" "+colType)
274 }
275 ddl := fmt.Sprintf("CREATE TABLE %s (%s);", backtickIdentifier(name), strings.Join(defs, ", "))
276 return execOK(cat, ddl)
277}
278
279// defineView installs a view in the catalog. Unlike tables, the only structured
280// input is the view's definition SQL, whose exact shape varies (full

Callers 1

defineTableFunction · 0.85

Calls 5

backtickIdentifierFunction · 0.85
execOKFunction · 0.85
JoinMethod · 0.80
GetTypeMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected