OutputColumns determines which columns a statement will output
(stmt ast.Node)
| 13 | |
| 14 | // OutputColumns determines which columns a statement will output |
| 15 | func (c *Compiler) OutputColumns(stmt ast.Node) ([]*catalog.Column, error) { |
| 16 | qc, err := c.buildQueryCatalog(c.catalog, stmt, nil) |
| 17 | if err != nil { |
| 18 | return nil, err |
| 19 | } |
| 20 | cols, err := c.outputColumns(qc, stmt) |
| 21 | if err != nil { |
| 22 | return nil, err |
| 23 | } |
| 24 | |
| 25 | catCols := make([]*catalog.Column, 0, len(cols)) |
| 26 | for _, col := range cols { |
| 27 | catCols = append(catCols, &catalog.Column{ |
| 28 | Name: col.Name, |
| 29 | Type: ast.TypeName{Name: col.DataType}, |
| 30 | IsNotNull: col.NotNull, |
| 31 | IsUnsigned: col.Unsigned, |
| 32 | IsArray: col.IsArray, |
| 33 | ArrayDims: col.ArrayDims, |
| 34 | Comment: col.Comment, |
| 35 | Length: col.Length, |
| 36 | }) |
| 37 | } |
| 38 | return catCols, nil |
| 39 | } |
| 40 | |
| 41 | func hasStarRef(cf *ast.ColumnRef) bool { |
| 42 | for _, item := range cf.Fields.Items { |
nothing calls this directly
no test coverage detected