[FEAT MERGE]sql compat feature

Co-authored-by: Zach41 <zach_41@163.com>
This commit is contained in:
zzg19950727
2023-08-30 11:44:37 +00:00
committed by ob-robot
parent 0dc1000829
commit 5e158ef5e9
39 changed files with 2339 additions and 477 deletions

View File

@ -421,12 +421,31 @@ int ObReverseLink::close()
return ret;
}
int ObDblinkUtils::has_reverse_link_or_any_dblink(const ObDMLStmt *stmt, bool &has, bool has_any_dblink) {
int ObDblinkUtils::has_reverse_link_or_any_dblink(const ObDMLStmt *stmt, bool &has, bool has_any_dblink)
{
int ret = OB_SUCCESS;
const common::ObIArray<TableItem*> &table_items = stmt->get_table_items();
ObArray<ObSelectStmt*> child_stmts;
for (int64_t i = 0; OB_SUCC(ret) && i < table_items.count(); ++i) {
const TableItem *table_item = table_items.at(i);
ObSEArray<ObRawExpr*, 2> seq_exprs;
if (OB_ISNULL(stmt)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpect null stmt", K(ret));
} else if (OB_FAIL(stmt->get_sequence_exprs(seq_exprs))) {
LOG_WARN("failed to get sequence exprs", K(ret));
}
for (int64_t i = 0; OB_SUCC(ret) && !has && i < seq_exprs.count(); ++i) {
ObRawExpr *expr = seq_exprs.at(i);
if (OB_ISNULL(expr)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("unexpect null expr", K(ret));
} else {
ObSequenceRawExpr *seq_expr = static_cast<ObSequenceRawExpr*>(expr);
if (OB_INVALID_ID != seq_expr->get_dblink_id()) {
has = true;
}
}
}
for (int64_t i = 0; OB_SUCC(ret) && i < stmt->get_table_items().count(); ++i) {
const TableItem *table_item = stmt->get_table_items().at(i);
if (OB_ISNULL(table_item)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get null ptr", K(ret));