(table *ast.TableName, col *ast.ColumnDef)
| 329 | } |
| 330 | |
| 331 | func (c *Catalog) defineColumn(table *ast.TableName, col *ast.ColumnDef) (*Column, error) { |
| 332 | tc := &Column{ |
| 333 | Name: col.Colname, |
| 334 | Type: *col.TypeName, |
| 335 | IsNotNull: col.IsNotNull, |
| 336 | IsUnsigned: col.IsUnsigned, |
| 337 | IsArray: col.IsArray, |
| 338 | ArrayDims: col.ArrayDims, |
| 339 | Comment: col.Comment, |
| 340 | Length: col.Length, |
| 341 | } |
| 342 | if col.Vals != nil { |
| 343 | typeName := ast.TypeName{ |
| 344 | Name: fmt.Sprintf("%s_%s", table.Name, col.Colname), |
| 345 | } |
| 346 | s := &ast.CreateEnumStmt{TypeName: &typeName, Vals: col.Vals} |
| 347 | if err := c.createEnum(s); err != nil { |
| 348 | return nil, err |
| 349 | } |
| 350 | tc.Type = typeName |
| 351 | tc.linkedType = true |
| 352 | } |
| 353 | return tc, nil |
| 354 | } |
| 355 | |
| 356 | func (c *Catalog) dropTable(stmt *ast.DropTableStmt) error { |
| 357 | for _, name := range stmt.Tables { |
no test coverage detected