ParseParameterizedSQL parse this parameterized SQL with the specified sctx.
(sctx sessionctx.Context, paramSQL string)
| 190 | |
| 191 | // ParseParameterizedSQL parse this parameterized SQL with the specified sctx. |
| 192 | func ParseParameterizedSQL(sctx sessionctx.Context, paramSQL string) (ast.StmtNode, error) { |
| 193 | p := parserPool.Get().(*parser.Parser) |
| 194 | defer parserPool.Put(p) |
| 195 | p.SetSQLMode(sctx.GetSessionVars().SQLMode) |
| 196 | p.SetParserConfig(sctx.GetSessionVars().BuildParserConfig()) |
| 197 | tmp, _, err := p.ParseSQL(paramSQL, sctx.GetSessionVars().GetParseParams()...) |
| 198 | if err != nil { |
| 199 | return nil, err |
| 200 | } |
| 201 | if len(tmp) != 1 { |
| 202 | return nil, errors.New("unexpected multiple statements") |
| 203 | } |
| 204 | return tmp[0], nil |
| 205 | } |
no test coverage detected