Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
大炮V587
oceanbase
提交
05d2d754
O
oceanbase
项目概览
大炮V587
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
05d2d754
编写于
12月 02, 2022
作者:
O
obdev
提交者:
ob-robot
1月 12, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CP] [to #44046555] fix print routine clause and agg function
上级
8779ec62
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
26 addition
and
9 deletion
+26
-9
src/share/schema/ob_schema_printer.cpp
src/share/schema/ob_schema_printer.cpp
+25
-9
src/share/schema/ob_schema_printer.h
src/share/schema/ob_schema_printer.h
+1
-0
未找到文件。
src/share/schema/ob_schema_printer.cpp
浏览文件 @
05d2d754
...
...
@@ -3795,6 +3795,7 @@ int ObSchemaPrinter::print_routine_definition(const ObRoutineInfo *routine_info,
const
ObStmtNodeTree
*
param_list
,
const
ObStmtNodeTree
*
return_type
,
const
ObString
&
body
,
const
ObString
&
clause
,
char
*
buf
,
const
int64_t
&
buf_len
,
int64_t
&
pos
,
...
...
@@ -3815,16 +3816,18 @@ int ObSchemaPrinter::print_routine_definition(const ObRoutineInfo *routine_info,
OX
(
routine_type
=
routine_info
->
is_procedure
()
?
"PROCEDURE"
:
"FUNCTION"
);
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
lib
::
is_oracle_mode
()
?
"CREATE OR REPLACE%s%.*s %s
\"
%.*s
\"
.
\"
%.*s
\"\n
"
:
"CREATE DEFINER =%s %.*s %s
`%.*s`.`%.*s`
\n
"
,
"CREATE OR REPLACE%s%.*s %s "
:
"CREATE DEFINER =%s %.*s %s "
,
routine_info
->
is_noneditionable
()
?
" NONEDITIONABLE"
:
""
,
routine_info
->
get_priv_user
().
length
(),
routine_info
->
get_priv_user
().
ptr
(),
routine_type
,
routine_type
));
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
lib
::
is_oracle_mode
()
?
"
\"
%.*s
\"
.
\"
%.*s
\"\n
"
:
"`%.*s`.`%.*s`
\n
"
,
db_schema
->
get_database_name_str
().
length
(),
db_schema
->
get_database_name_str
().
ptr
(),
routine_info
->
get_routine_name
().
length
(),
routine_info
->
get_routine_name
().
ptr
()),
routine_type
,
db_name
,
routine_info
);
routine_info
->
get_routine_name
().
ptr
()),
K
(
routine_type
),
K
(
db_name
),
K
(
routine_info
)
);
if
(
OB_SUCC
(
ret
)
&&
routine_info
->
get_param_count
()
>
0
)
{
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
"(
\n
"
));
OZ
(
print_routine_definition_param
(
*
routine_info
,
param_list
,
buf
,
buf_len
,
pos
,
tz_info
));
...
...
@@ -3850,7 +3853,12 @@ int ObSchemaPrinter::print_routine_definition(const ObRoutineInfo *routine_info,
"`"
));
}
}
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
lib
::
is_oracle_mode
()
?
" IS
\n
%.*s"
:
" %.*s"
,
body
.
length
(),
body
.
ptr
()));
if
(
OB_SUCC
(
ret
)
&&
lib
::
is_oracle_mode
()
&&
!
clause
.
empty
())
{
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
" %.*s"
,
clause
.
length
(),
clause
.
ptr
()));
}
OZ
(
databuff_printf
(
buf
,
buf_len
,
pos
,
lib
::
is_oracle_mode
()
?
(
routine_info
->
is_aggregate
()
?
"
\n
AGGREGATE USING %.*s"
:
" IS
\n
%.*s"
)
:
" %.*s"
,
body
.
length
(),
body
.
ptr
()));
return
ret
;
}
...
...
@@ -3869,16 +3877,19 @@ int ObSchemaPrinter::print_routine_definition(
ret
=
OB_ERR_SP_DOES_NOT_EXIST
;
SHARE_SCHEMA_LOG
(
WARN
,
"Unknow routine"
,
K
(
ret
),
K
(
routine_id
));
}
else
if
(
lib
::
is_mysql_mode
())
{
OZ
(
print_routine_definition
(
routine_info
,
NULL
,
NULL
,
routine_info
->
get_routine_body
(),
buf
,
buf_len
,
pos
,
tz_info
));
ObString
clause
;
OZ
(
print_routine_definition
(
routine_info
,
NULL
,
NULL
,
routine_info
->
get_routine_body
(),
clause
,
buf
,
buf_len
,
pos
,
tz_info
));
}
else
{
// oracle mode
ObString
routine_body
=
routine_info
->
get_routine_body
();
ObString
actully_body
;
ObString
routine_clause
;
ObStmtNodeTree
*
parse_tree
=
NULL
;
const
ObStmtNodeTree
*
routine_tree
=
NULL
;
ObArenaAllocator
allocator
;
pl
::
ObPLParser
parser
(
allocator
,
CS_TYPE_UTF8MB4_BIN
);
const
ObStmtNodeTree
*
param_list
=
NULL
;
const
ObStmtNodeTree
*
return_type
=
NULL
;
ObStmtNodeTree
*
param_list
=
NULL
;
ObStmtNodeTree
*
return_type
=
NULL
;
ObStmtNodeTree
*
clause_list
=
NULL
;
CK
(
!
routine_body
.
empty
());
OZ
(
parser
.
parse_routine_body
(
routine_body
,
parse_tree
,
false
));
CK
(
OB_NOT_NULL
(
parse_tree
));
...
...
@@ -3901,6 +3912,7 @@ int ObSchemaPrinter::print_routine_definition(
CK
(
OB_NOT_NULL
(
routine_tree
));
LOG_INFO
(
"print routine define"
,
K
(
routine_tree
->
type_
),
K
(
routine_info
->
is_function
()),
K
(
routine_body
));
CK
(
routine_info
->
is_function
()
?
T_SF_SOURCE
==
routine_tree
->
type_
||
T_SF_AGGREGATE_SOURCE
==
routine_tree
->
type_
:
T_SP_SOURCE
==
routine_tree
->
type_
);
CK
(
routine_info
->
is_function
()
?
6
==
routine_tree
->
num_child_
:
4
==
routine_tree
->
num_child_
);
...
...
@@ -3909,10 +3921,14 @@ int ObSchemaPrinter::print_routine_definition(
OX
(
actully_body
=
routine_info
->
is_function
()
?
ObString
(
routine_tree
->
children_
[
5
]
->
str_len_
,
routine_tree
->
children_
[
5
]
->
str_value_
)
:
ObString
(
routine_tree
->
children_
[
3
]
->
str_len_
,
routine_tree
->
children_
[
3
]
->
str_value_
));
OX
(
clause_list
=
routine_info
->
is_function
()
?
routine_tree
->
children_
[
3
]
:
routine_tree
->
children_
[
2
]);
if
(
OB_SUCC
(
ret
)
&&
OB_NOT_NULL
(
clause_list
))
{
OX
(
routine_clause
=
ObString
(
clause_list
->
str_len_
,
clause_list
->
str_value_
));
}
OX
(
param_list
=
routine_tree
->
children_
[
1
]);
OX
(
return_type
=
(
routine_info
->
is_function
()
?
routine_tree
->
children_
[
2
]
:
NULL
));
CK
(
!
actully_body
.
empty
());
OZ
(
print_routine_definition
(
routine_info
,
param_list
,
return_type
,
actully_body
,
buf
,
buf_len
,
pos
,
tz_info
));
OZ
(
print_routine_definition
(
routine_info
,
param_list
,
return_type
,
actully_body
,
routine_clause
,
buf
,
buf_len
,
pos
,
tz_info
));
}
return
ret
;
}
...
...
src/share/schema/ob_schema_printer.h
浏览文件 @
05d2d754
...
...
@@ -327,6 +327,7 @@ public:
const
ObStmtNodeTree
*
param_list
,
const
ObStmtNodeTree
*
return_type
,
const
common
::
ObString
&
body
,
const
common
::
ObString
&
clause
,
char
*
buf
,
const
int64_t
&
buf_len
,
int64_t
&
pos
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录