Skip to content

Commit bf3b0f7

Browse files
committed
feat: support CREATE PROCEDURE
1 parent 56d64ef commit bf3b0f7

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
@@ -1442,6 +1442,24 @@ func (c *cc) convertCallStmt(n *pcast.CallStmt) ast.Node {
14421442
}
14431443
}
14441444

1445+
func (c *cc) convertProcedureInfo(n *pcast.ProcedureInfo) ast.Node {
1446+
var params ast.List
1447+
for _, sp := range n.ProcedureParam {
1448+
paramName := sp.ParamName
1449+
params.Items = append(params.Items, &ast.FuncParam{
1450+
Name: &paramName,
1451+
Type: &ast.TypeName{Name: types.TypeToStr(sp.ParamType.GetType(), sp.ParamType.GetCharset())},
1452+
})
1453+
}
1454+
return &ast.CreateFunctionStmt{
1455+
Params: &params,
1456+
Func: &ast.FuncName{
1457+
Schema: n.ProcedureName.Schema.L,
1458+
Name: n.ProcedureName.Name.L,
1459+
},
1460+
}
1461+
}
1462+
14451463
func (c *cc) convert(node pcast.Node) ast.Node {
14461464
switch n := node.(type) {
14471465

@@ -1718,6 +1736,9 @@ func (c *cc) convert(node pcast.Node) ast.Node {
17181736
case *pcast.PrivElem:
17191737
return c.convertPrivElem(n)
17201738

1739+
case *pcast.ProcedureInfo:
1740+
return c.convertProcedureInfo(n)
1741+
17211742
case *pcast.RecoverTableStmt:
17221743
return c.convertRecoverTableStmt(n)
17231744

0 commit comments

Comments
 (0)