(parserErr error)
| 127 | ) |
| 128 | |
| 129 | func convertParserError(parserErr error) error { |
| 130 | // line 1 column 15 near "TO world;" |
| 131 | res := lineColumnRegex.FindAllStringSubmatch(parserErr.Error(), -1) |
| 132 | if len(res) != 1 { |
| 133 | return parserErr |
| 134 | } |
| 135 | if len(res[0]) != 3 { |
| 136 | return parserErr |
| 137 | } |
| 138 | line, err := strconv.ParseInt(res[0][1], 10, 32) |
| 139 | if err != nil { |
| 140 | return parserErr |
| 141 | } |
| 142 | column, err := strconv.ParseInt(res[0][2], 10, 32) |
| 143 | if err != nil { |
| 144 | return parserErr |
| 145 | } |
| 146 | return &base.SyntaxError{ |
| 147 | Position: common.ConvertTiDBParserErrorPositionToPosition(int32(line), int32(column)), |
| 148 | Message: parserErr.Error(), |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // SetLineForMySQLCreateTableStmt sets the line for columns and table constraints in MySQL CREATE TABLE statments. |
| 153 | // This is a temporary function. Because we do not convert tidb AST to our AST. So we have to implement this. |
no test coverage detected