patch 4.0

This commit is contained in:
wangzelin.wzl
2022-10-24 10:34:53 +08:00
parent 4ad6e00ec3
commit 93a1074b0c
10533 changed files with 2588271 additions and 2299373 deletions

View File

@ -18,112 +18,51 @@
#include "sql/resolver/ddl/ob_ddl_stmt.h"
#include "share/system_variable/ob_system_variable.h"
namespace oceanbase {
namespace sql {
class ObVariableSetStmt : public ObDDLStmt {
namespace oceanbase
{
namespace sql
{
class ObVariableSetStmt : public ObDDLStmt
{
public:
class VariableSetNode {
class VariableSetNode
{
public:
VariableSetNode()
: variable_name_(),
is_system_variable_(false),
set_scope_(share::ObSetVar::SET_SCOPE_NEXT_TRANS),
value_expr_(NULL),
is_set_default_(false)
VariableSetNode() : variable_name_(),
is_system_variable_(false),
set_scope_(share::ObSetVar::SET_SCOPE_NEXT_TRANS),
value_expr_(NULL),
is_set_default_(false)
{}
virtual ~VariableSetNode()
{}
TO_STRING_KV(K_(variable_name), K_(is_system_variable), K_(set_scope), K_(value_expr), K_(is_set_default));
virtual ~VariableSetNode() {}
TO_STRING_KV(K_(variable_name), K_(is_system_variable),
K_(set_scope), K_(value_expr), K_(is_set_default));
common::ObString variable_name_;
bool is_system_variable_;
share::ObSetVar::SetScopeType set_scope_;
ObRawExpr* value_expr_;
ObRawExpr *value_expr_;
bool is_set_default_;
};
class NamesSetNode {
public:
NamesSetNode()
: is_set_names_(true),
is_default_charset_(true),
is_default_collation_(true),
charset_(),
collation_()
{}
virtual ~NamesSetNode()
{}
TO_STRING_KV(K_(is_set_names), K_(is_default_charset), K_(is_default_collation), K_(charset), K_(collation));
bool is_set_names_; // SET NAMES or SET CHARSET?
bool is_default_charset_;
bool is_default_collation_;
common::ObString charset_;
common::ObString collation_;
};
class VariableNamesSetNode {
public:
VariableNamesSetNode()
: is_set_variable_(true),
var_set_node_(),
names_set_node_()
{}
VariableNamesSetNode(bool is_set_variable, const VariableSetNode &var_node,
const NamesSetNode &names_node)
: is_set_variable_(is_set_variable),
var_set_node_(var_node),
names_set_node_(names_node)
{}
virtual ~VariableNamesSetNode()
{}
TO_STRING_KV(K_(is_set_variable), K_(var_set_node), K_(names_set_node));
bool is_set_variable_; // set variables or set names
VariableSetNode var_set_node_;
NamesSetNode names_set_node_;
};
ObVariableSetStmt()
: ObDDLStmt(stmt::T_VARIABLE_SET),
actual_tenant_id_(common::OB_INVALID_ID),
variable_nodes_(),
has_global_variable_(false)
{}
virtual ~ObVariableSetStmt()
ObVariableSetStmt() : ObDDLStmt(stmt::T_VARIABLE_SET),
actual_tenant_id_(common::OB_INVALID_ID),
variable_nodes_(),
has_global_variable_(false)
{}
virtual ~ObVariableSetStmt() {}
static inline VariableNamesSetNode make_variable_name_node(VariableSetNode& var_set_node) {
return VariableNamesSetNode(true, var_set_node, NamesSetNode());
}
static inline VariableNamesSetNode make_variable_name_node(NamesSetNode& names_set_node) {
return VariableNamesSetNode(false, VariableSetNode(), names_set_node);
}
inline void set_actual_tenant_id(uint64_t actual_tenant_id)
{
actual_tenant_id_ = actual_tenant_id;
}
inline uint64_t get_actual_tenant_id() const
{
return actual_tenant_id_;
}
inline int add_variable_node(const VariableNamesSetNode& node);
inline void set_actual_tenant_id(uint64_t actual_tenant_id) { actual_tenant_id_ = actual_tenant_id; }
inline uint64_t get_actual_tenant_id() const { return actual_tenant_id_; }
inline int add_variable_node(const VariableSetNode &node);
inline int64_t get_variables_size() const;
int get_variable_node(int64_t index, VariableNamesSetNode& node) const;
int get_variable_node(int64_t index, VariableSetNode &node) const;
inline void set_has_global_variable(bool has_global_variable)
{
has_global_variable_ = has_global_variable;
}
inline bool has_global_variable() const
{
return has_global_variable_;
}
{ has_global_variable_ = has_global_variable; }
inline bool has_global_variable() const { return has_global_variable_; }
virtual int get_cmd_type() const
{
return get_stmt_type();
}
virtual bool cause_implicit_commit() const
{
virtual int get_cmd_type() const { return get_stmt_type(); }
virtual bool cause_implicit_commit() const {
/* when VariableSet is SET AUTOCOMMIT=? statement,
* and autocommit turns from 0 to 1,
* it cause implicit commit in its executor.
@ -133,25 +72,19 @@ public:
return false;
}
const common::ObIArray<VariableNamesSetNode>& get_variable_nodes() const
{
return variable_nodes_;
}
virtual obrpc::ObDDLArg& get_ddl_arg()
{
return modify_sysvar_arg_;
}
const common::ObIArray<VariableSetNode> &get_variable_nodes() const
{ return variable_nodes_; }
virtual obrpc::ObDDLArg &get_ddl_arg() { return modify_sysvar_arg_; }
TO_STRING_KV(K_(actual_tenant_id), K_(variable_nodes));
private:
uint64_t actual_tenant_id_;
common::ObArray<VariableNamesSetNode, common::ModulePageAllocator, true> variable_nodes_;
common::ObArray<VariableSetNode, common::ModulePageAllocator, true> variable_nodes_;
bool has_global_variable_;
obrpc::ObModifySysVarArg modify_sysvar_arg_;
obrpc::ObModifySysVarArg modify_sysvar_arg_; // 用于返回exec_tenant_id_
DISALLOW_COPY_AND_ASSIGN(ObVariableSetStmt);
};
inline int ObVariableSetStmt::add_variable_node(const VariableNamesSetNode& node)
inline int ObVariableSetStmt::add_variable_node(const VariableSetNode &node)
{
return variable_nodes_.push_back(node);
}
@ -160,7 +93,7 @@ inline int64_t ObVariableSetStmt::get_variables_size() const
{
return variable_nodes_.count();
}
} // end of namespace sql
} // end of namespace oceanbase
}//end of namespace sql
}//end of namespace oceanbase
#endif // OCEANBASE_SQL_RESOLVER_CMD_VARIABLE_SET_STMT_
#endif //OCEANBASE_SQL_RESOLVER_CMD_VARIABLE_SET_STMT_