(list *ast.List, result *ast.List)
| 41 | } |
| 42 | |
| 43 | func convertToRangeVarList(list *ast.List, result *ast.List) { |
| 44 | if len(list.Items) == 0 { |
| 45 | return |
| 46 | } |
| 47 | switch rel := list.Items[0].(type) { |
| 48 | |
| 49 | // Special case for joins in updates |
| 50 | case *ast.JoinExpr: |
| 51 | left, ok := rel.Larg.(*ast.RangeVar) |
| 52 | if !ok { |
| 53 | if list, check := rel.Larg.(*ast.List); check { |
| 54 | convertToRangeVarList(list, result) |
| 55 | } else if subselect, check := rel.Larg.(*ast.RangeSubselect); check { |
| 56 | // Handle subqueries in JOIN clauses |
| 57 | result.Items = append(result.Items, subselect) |
| 58 | } else { |
| 59 | panic("expected range var") |
| 60 | } |
| 61 | } |
| 62 | if left != nil { |
| 63 | result.Items = append(result.Items, left) |
| 64 | } |
| 65 | |
| 66 | right, ok := rel.Rarg.(*ast.RangeVar) |
| 67 | if !ok { |
| 68 | if list, check := rel.Rarg.(*ast.List); check { |
| 69 | convertToRangeVarList(list, result) |
| 70 | } else if subselect, check := rel.Rarg.(*ast.RangeSubselect); check { |
| 71 | // Handle subqueries in JOIN clauses |
| 72 | result.Items = append(result.Items, subselect) |
| 73 | } else { |
| 74 | panic("expected range var") |
| 75 | } |
| 76 | } |
| 77 | if right != nil { |
| 78 | result.Items = append(result.Items, right) |
| 79 | } |
| 80 | |
| 81 | case *ast.RangeVar: |
| 82 | result.Items = append(result.Items, rel) |
| 83 | |
| 84 | case *ast.RangeSubselect: |
| 85 | result.Items = append(result.Items, rel) |
| 86 | |
| 87 | default: |
| 88 | panic("expected range var") |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func isUnsigned(n *pcast.ColumnDef) bool { |
| 93 | return mysql.HasUnsignedFlag(n.Tp.GetFlag()) |
no outgoing calls
no test coverage detected