Skip to content

Commit a4057af

Browse files
committed
feat: support CREATE PROCEDURE
1 parent eb915ff commit a4057af

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

internal/engine/dolphin/convert.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,6 +1458,24 @@ func (c *cc) convertCallStmt(n *pcast.CallStmt) ast.Node {
14581458
}
14591459
}
14601460

1461+
func (c *cc) convertProcedureInfo(n *pcast.ProcedureInfo) ast.Node {
1462+
var params ast.List
1463+
for _, sp := range n.ProcedureParam {
1464+
paramName := sp.ParamName
1465+
params.Items = append(params.Items, &ast.FuncParam{
1466+
Name: &paramName,
1467+
Type: &ast.TypeName{Name: types.TypeToStr(sp.ParamType.GetType(), sp.ParamType.GetCharset())},
1468+
})
1469+
}
1470+
return &ast.CreateFunctionStmt{
1471+
Params: &params,
1472+
Func: &ast.FuncName{
1473+
Schema: n.ProcedureName.Schema.L,
1474+
Name: n.ProcedureName.Name.L,
1475+
},
1476+
}
1477+
}
1478+
14611479
func (c *cc) convert(node pcast.Node) ast.Node {
14621480
switch n := node.(type) {
14631481

@@ -1734,6 +1752,9 @@ func (c *cc) convert(node pcast.Node) ast.Node {
17341752
case *pcast.PrivElem:
17351753
return c.convertPrivElem(n)
17361754

1755+
case *pcast.ProcedureInfo:
1756+
return c.convertProcedureInfo(n)
1757+
17371758
case *pcast.RecoverTableStmt:
17381759
return c.convertRecoverTableStmt(n)
17391760

0 commit comments

Comments
 (0)