(sel *SqlSelect, newCols []string)
| 136 | addIntoProjection(sel, colsToAdd) |
| 137 | } |
| 138 | func addIntoProjection(sel *SqlSelect, newCols []string) { |
| 139 | notExists := make(map[string]bool) |
| 140 | for _, colName := range newCols { |
| 141 | colName = strings.ToLower(colName) |
| 142 | found := false |
| 143 | for _, c := range sel.Columns { |
| 144 | if c.SourceField == colName { |
| 145 | // already in projection |
| 146 | found = true |
| 147 | break |
| 148 | } |
| 149 | } |
| 150 | if !found { |
| 151 | notExists[colName] = true |
| 152 | if colName == "*" { |
| 153 | sel.AddColumn(Column{Star: true}) |
| 154 | } else { |
| 155 | nc := NewColumn(colName) |
| 156 | sel.AddColumn(*nc) |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | func rewriteWhere(stmt *SqlSelect, from *SqlSource, node expr.Node, cols Columns) (expr.Node, Columns) { |
| 162 | //u.Debugf("rewrite where %s", node) |
| 163 | switch nt := node.(type) { |
no test coverage detected