patch 4.0
This commit is contained in:
1
src/sql/resolver/tcl/README
Normal file
1
src/sql/resolver/tcl/README
Normal file
@ -0,0 +1 @@
|
||||
Transaction Control Language
|
||||
@ -14,27 +14,37 @@
|
||||
|
||||
#include "ob_end_trans_resolver.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
namespace sql {
|
||||
namespace sql
|
||||
{
|
||||
|
||||
ObEndTransResolver::ObEndTransResolver(ObResolverParams& params) : ObTCLResolver(params)
|
||||
{}
|
||||
ObEndTransResolver::ObEndTransResolver(ObResolverParams ¶ms)
|
||||
: ObTCLResolver(params)
|
||||
{
|
||||
}
|
||||
|
||||
ObEndTransResolver::~ObEndTransResolver()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int ObEndTransResolver::resolve(const ParseNode& parse_node)
|
||||
int ObEndTransResolver::resolve(const ParseNode &parse_node)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObEndTransStmt* end_stmt = NULL;
|
||||
if (OB_LIKELY((T_COMMIT == parse_node.type_ || T_ROLLBACK == parse_node.type_) && parse_node.num_child_ == 0)) {
|
||||
ObEndTransStmt *end_stmt = NULL;
|
||||
if (OB_LIKELY((T_COMMIT == parse_node.type_ || T_ROLLBACK == parse_node.type_)
|
||||
&& parse_node.num_child_ == 1)) {
|
||||
if (OB_UNLIKELY(NULL == (end_stmt = create_stmt<ObEndTransStmt>()))) {
|
||||
ret = OB_SQL_RESOLVER_NO_MEMORY;
|
||||
LOG_WARN("failed to create select stmt");
|
||||
} else {
|
||||
stmt_ = end_stmt;
|
||||
end_stmt->set_is_rollback(T_ROLLBACK == parse_node.type_);
|
||||
auto hint = parse_node.children_[0];
|
||||
if (hint) {
|
||||
end_stmt->set_hint(ObString(hint->str_len_, hint->str_value_));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
@ -43,5 +53,7 @@ int ObEndTransResolver::resolve(const ParseNode& parse_node)
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}/* ns sql*/
|
||||
}/* ns oceanbase */
|
||||
|
||||
|
||||
|
||||
@ -17,21 +17,24 @@
|
||||
#include "sql/resolver/tcl/ob_tcl_resolver.h"
|
||||
#include "sql/resolver/tcl/ob_end_trans_stmt.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObEndTransResolver : public ObTCLResolver {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObEndTransResolver : public ObTCLResolver
|
||||
{
|
||||
public:
|
||||
explicit ObEndTransResolver(ObResolverParams& params);
|
||||
explicit ObEndTransResolver(ObResolverParams ¶ms);
|
||||
virtual ~ObEndTransResolver();
|
||||
|
||||
virtual int resolve(const ParseNode& parse_node);
|
||||
|
||||
virtual int resolve(const ParseNode &parse_node);
|
||||
private:
|
||||
/* functions */
|
||||
/* variables */
|
||||
DISALLOW_COPY_AND_ASSIGN(ObEndTransResolver);
|
||||
};
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}
|
||||
}
|
||||
#endif /* OCEANBASE_SQL_RESOLVER_TCL_END_TRANS_RESOLVER_ */
|
||||
//// end of header file
|
||||
|
||||
|
||||
@ -13,37 +13,33 @@
|
||||
#ifndef _OB_END_TRANS_STMT_H
|
||||
#define _OB_END_TRANS_STMT_H
|
||||
#include "sql/resolver/tcl/ob_tcl_stmt.h"
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObEndTransStmt : public ObTCLStmt {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObEndTransStmt: public ObTCLStmt
|
||||
{
|
||||
public:
|
||||
ObEndTransStmt() : ObTCLStmt(stmt::T_END_TRANS), is_rollback_(false)
|
||||
{}
|
||||
virtual ~ObEndTransStmt()
|
||||
{}
|
||||
virtual void print(FILE* fp, int32_t level, int32_t index);
|
||||
|
||||
void set_is_rollback(bool val)
|
||||
{
|
||||
is_rollback_ = val;
|
||||
}
|
||||
bool get_is_rollback() const
|
||||
{
|
||||
return is_rollback_;
|
||||
}
|
||||
ObEndTransStmt(): ObTCLStmt(stmt::T_END_TRANS), is_rollback_(false), hint_() {}
|
||||
virtual ~ObEndTransStmt() {}
|
||||
virtual void print(FILE *fp, int32_t level, int32_t index);
|
||||
|
||||
void set_is_rollback(bool val) {is_rollback_ = val;}
|
||||
bool get_is_rollback() const {return is_rollback_;}
|
||||
const ObString &get_hint() const { return hint_; }
|
||||
void set_hint(const ObString hint) { hint_ = hint; }
|
||||
private:
|
||||
// types and constants
|
||||
// function members
|
||||
private:
|
||||
// data members
|
||||
bool is_rollback_;
|
||||
|
||||
ObString hint_;
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObEndTransStmt);
|
||||
};
|
||||
inline void ObEndTransStmt::print(FILE* fp, int32_t level, int32_t index)
|
||||
inline void ObEndTransStmt::print(FILE *fp, int32_t level, int32_t index)
|
||||
{
|
||||
print_indentation(fp, level);
|
||||
fprintf(fp, "<ObEndTransStmt id=%d>\n", index);
|
||||
@ -52,7 +48,7 @@ inline void ObEndTransStmt::print(FILE* fp, int32_t level, int32_t index)
|
||||
print_indentation(fp, level);
|
||||
fprintf(fp, "</ObEndTransStmt>\n");
|
||||
}
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
||||
#endif /* _OB_END_TRANS_STMT_H */
|
||||
|
||||
@ -14,14 +14,16 @@
|
||||
#include "ob_savepoint_resolver.h"
|
||||
#include "ob_savepoint_stmt.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
int ObSavePointResolver::resolve(const ParseNode& parse_tree)
|
||||
int ObSavePointResolver::resolve(const ParseNode &parse_tree)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSavePointStmt* stmt = NULL;
|
||||
ObSavePointStmt *stmt = NULL;
|
||||
if (OB_FAIL(create_savepoint_stmt(parse_tree.type_, stmt)) || OB_ISNULL(stmt)) {
|
||||
LOG_WARN("failed to create savepoint stmt", K(ret));
|
||||
} else if (OB_FAIL(stmt->set_sp_name(parse_tree.str_value_, parse_tree.str_len_))) {
|
||||
@ -32,25 +34,26 @@ int ObSavePointResolver::resolve(const ParseNode& parse_tree)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObSavePointResolver::create_savepoint_stmt(ObItemType stmt_type, ObSavePointStmt*& stmt)
|
||||
int ObSavePointResolver::create_savepoint_stmt(ObItemType stmt_type, ObSavePointStmt *&stmt)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
switch (stmt_type) {
|
||||
case T_CREATE_SAVEPOINT:
|
||||
stmt = create_stmt<ObCreateSavePointStmt>();
|
||||
break;
|
||||
case T_ROLLBACK_SAVEPOINT:
|
||||
stmt = create_stmt<ObRollbackSavePointStmt>();
|
||||
break;
|
||||
case T_RELEASE_SAVEPOINT:
|
||||
stmt = create_stmt<ObReleaseSavePointStmt>();
|
||||
break;
|
||||
default:
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid stmt type", K(ret), K(stmt_type));
|
||||
case T_CREATE_SAVEPOINT:
|
||||
stmt = create_stmt<ObCreateSavePointStmt>();
|
||||
break;
|
||||
case T_ROLLBACK_SAVEPOINT:
|
||||
stmt = create_stmt<ObRollbackSavePointStmt>();
|
||||
break;
|
||||
case T_RELEASE_SAVEPOINT:
|
||||
stmt = create_stmt<ObReleaseSavePointStmt>();
|
||||
break;
|
||||
default:
|
||||
ret = OB_INVALID_ARGUMENT;
|
||||
LOG_WARN("invalid stmt type", K(ret), K(stmt_type));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
|
||||
@ -15,24 +15,28 @@
|
||||
|
||||
#include "sql/resolver/ob_stmt_resolver.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ObSavePointStmt;
|
||||
class ObSavePointResolver : public ObStmtResolver {
|
||||
class ObSavePointResolver : public ObStmtResolver
|
||||
{
|
||||
public:
|
||||
explicit ObSavePointResolver(ObResolverParams& params) : ObStmtResolver(params)
|
||||
explicit ObSavePointResolver(ObResolverParams ¶ms)
|
||||
: ObStmtResolver(params)
|
||||
{}
|
||||
virtual ~ObSavePointResolver()
|
||||
{}
|
||||
virtual int resolve(const ParseNode& parse_tree);
|
||||
int create_savepoint_stmt(ObItemType stmt_type, ObSavePointStmt*& stmt);
|
||||
|
||||
virtual int resolve(const ParseNode &parse_tree);
|
||||
int create_savepoint_stmt(ObItemType stmt_type, ObSavePointStmt *&stmt);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObSavePointResolver);
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
#endif // OCEANBASE_SQL_RESOLVER_TCL_OB_SAVEPOINT_RESOLVER_
|
||||
|
||||
#endif // OCEANBASE_SQL_RESOLVER_TCL_OB_SAVEPOINT_RESOLVER_
|
||||
|
||||
@ -13,11 +13,13 @@
|
||||
#define USING_LOG_PREFIX SQL_RESV
|
||||
#include "ob_savepoint_stmt.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
using namespace common;
|
||||
|
||||
int ObSavePointStmt::set_sp_name(const char* str_value, int64_t str_len)
|
||||
int ObSavePointStmt::set_sp_name(const char *str_value, int64_t str_len)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (OB_ISNULL(str_value) || str_len <= 0) {
|
||||
@ -29,5 +31,6 @@ int ObSavePointStmt::set_sp_name(const char* str_value, int64_t str_len)
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
|
||||
@ -15,29 +15,32 @@
|
||||
|
||||
#include "sql/resolver/tcl/ob_tcl_stmt.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ObSavePointStmt : public ObTCLStmt {
|
||||
class ObSavePointStmt : public ObTCLStmt
|
||||
{
|
||||
public:
|
||||
explicit ObSavePointStmt(stmt::StmtType type) : ObTCLStmt(type), sp_name_()
|
||||
explicit ObSavePointStmt(stmt::StmtType type)
|
||||
: ObTCLStmt(type),
|
||||
sp_name_()
|
||||
{}
|
||||
virtual ~ObSavePointStmt()
|
||||
{}
|
||||
int set_sp_name(const char* str_value, int64_t str_len);
|
||||
inline const common::ObString& get_sp_name() const
|
||||
{
|
||||
return sp_name_;
|
||||
}
|
||||
|
||||
int set_sp_name(const char *str_value, int64_t str_len);
|
||||
inline const common::ObString &get_sp_name() const { return sp_name_; }
|
||||
private:
|
||||
common::ObString sp_name_;
|
||||
DISALLOW_COPY_AND_ASSIGN(ObSavePointStmt);
|
||||
};
|
||||
|
||||
class ObCreateSavePointStmt : public ObSavePointStmt {
|
||||
class ObCreateSavePointStmt : public ObSavePointStmt
|
||||
{
|
||||
public:
|
||||
explicit ObCreateSavePointStmt() : ObSavePointStmt(stmt::T_CREATE_SAVEPOINT)
|
||||
explicit ObCreateSavePointStmt()
|
||||
: ObSavePointStmt(stmt::T_CREATE_SAVEPOINT)
|
||||
{}
|
||||
virtual ~ObCreateSavePointStmt()
|
||||
{}
|
||||
@ -46,9 +49,11 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObCreateSavePointStmt);
|
||||
};
|
||||
|
||||
class ObRollbackSavePointStmt : public ObSavePointStmt {
|
||||
class ObRollbackSavePointStmt : public ObSavePointStmt
|
||||
{
|
||||
public:
|
||||
explicit ObRollbackSavePointStmt() : ObSavePointStmt(stmt::T_ROLLBACK_SAVEPOINT)
|
||||
explicit ObRollbackSavePointStmt()
|
||||
: ObSavePointStmt(stmt::T_ROLLBACK_SAVEPOINT)
|
||||
{}
|
||||
virtual ~ObRollbackSavePointStmt()
|
||||
{}
|
||||
@ -57,9 +62,11 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObRollbackSavePointStmt);
|
||||
};
|
||||
|
||||
class ObReleaseSavePointStmt : public ObSavePointStmt {
|
||||
class ObReleaseSavePointStmt : public ObSavePointStmt
|
||||
{
|
||||
public:
|
||||
explicit ObReleaseSavePointStmt() : ObSavePointStmt(stmt::T_RELEASE_SAVEPOINT)
|
||||
explicit ObReleaseSavePointStmt()
|
||||
: ObSavePointStmt(stmt::T_RELEASE_SAVEPOINT)
|
||||
{}
|
||||
virtual ~ObReleaseSavePointStmt()
|
||||
{}
|
||||
@ -68,7 +75,8 @@ private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObReleaseSavePointStmt);
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
#endif // OCEANBASE_SQL_RESOLVER_TCL_OB_SAVEPOINT_STMT_
|
||||
|
||||
#endif // OCEANBASE_SQL_RESOLVER_TCL_OB_SAVEPOINT_STMT_
|
||||
|
||||
@ -15,58 +15,72 @@
|
||||
#include "ob_start_trans_resolver.h"
|
||||
#include "sql/session/ob_sql_session_info.h"
|
||||
#include "sql/ob_trans_character.h"
|
||||
#include "share/schema/ob_sys_variable_mgr.h" // ObSimpleSysVariableSchema
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
using namespace share;
|
||||
namespace sql {
|
||||
namespace sql
|
||||
{
|
||||
|
||||
ObStartTransResolver::ObStartTransResolver(ObResolverParams& params) : ObTCLResolver(params)
|
||||
{}
|
||||
ObStartTransResolver::ObStartTransResolver(ObResolverParams ¶ms)
|
||||
: ObTCLResolver(params)
|
||||
{
|
||||
}
|
||||
|
||||
ObStartTransResolver::~ObStartTransResolver()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int ObStartTransResolver::resolve(const ParseNode& parse_node)
|
||||
int ObStartTransResolver::resolve(const ParseNode &parse_node)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObStartTransStmt* start_stmt = NULL;
|
||||
if (OB_UNLIKELY(T_BEGIN != parse_node.type_ || 1 != parse_node.num_child_)) {
|
||||
ObStartTransStmt *start_stmt = NULL;
|
||||
if (OB_UNLIKELY(T_BEGIN != parse_node.type_ || 2 != parse_node.num_child_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_ERROR("unexpected val", K(parse_node.type_), K(parse_node.num_child_), K(ret));
|
||||
} else if (OB_UNLIKELY(NULL == (start_stmt = create_stmt<ObStartTransStmt>()))) {
|
||||
ret = OB_SQL_RESOLVER_NO_MEMORY;
|
||||
LOG_WARN("failed to create select stmt", K(ret));
|
||||
} else if (OB_ISNULL(schema_checker_)
|
||||
|| OB_ISNULL(schema_checker_->get_schema_guard())) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("schema guard is null", KR(ret));
|
||||
} else {
|
||||
stmt_ = start_stmt;
|
||||
const uint64_t tenant_id = session_info_->get_effective_tenant_id();
|
||||
const share::schema::ObSysVariableSchema* sys_variable = NULL;
|
||||
if (OB_FAIL(schema_checker_->get_sys_variable_schema(tenant_id, sys_variable))) {
|
||||
// Use initial simple sys variable while create a tenant to avoid cyclic dependence
|
||||
const share::schema::ObSimpleSysVariableSchema *sys_variable = NULL;
|
||||
share::schema::ObSchemaGetterGuard *schema_guard = schema_checker_->get_schema_guard();
|
||||
if (OB_FAIL(schema_guard->get_sys_variable_schema(tenant_id, sys_variable))) {
|
||||
LOG_WARN("fail to get sys variable schema", K(tenant_id), K(ret));
|
||||
} else if (OB_ISNULL(sys_variable)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("sys variable should not be null", K(tenant_id), K(ret));
|
||||
} else if (OB_UNLIKELY(!session_info_->has_user_super_privilege() && sys_variable->is_read_only() &&
|
||||
IS_READ_WRITE(parse_node.children_[0]->value_))) {
|
||||
} else if (OB_UNLIKELY(!session_info_->has_user_super_privilege()
|
||||
&& sys_variable->get_read_only()
|
||||
&& IS_READ_WRITE(parse_node.children_[0]->value_))) {
|
||||
ret = OB_ERR_OPTION_PREVENTS_STATEMENT;
|
||||
|
||||
LOG_WARN("the server is running with read_only, cannot execute stmt");
|
||||
} else {
|
||||
bool tx_read_only = params_.session_info_->get_tx_read_only();
|
||||
if (IS_READ_ONLY(parse_node.children_[0]->value_)) {
|
||||
start_stmt->set_read_only(true);
|
||||
} else if (IS_READ_WRITE(parse_node.children_[0]->value_)) {
|
||||
start_stmt->set_read_only(false);
|
||||
} else {
|
||||
start_stmt->set_read_only(tx_read_only);
|
||||
}
|
||||
if (IS_WITH_SNAPSHOT(parse_node.children_[0]->value_)) {
|
||||
start_stmt->set_with_consistent_snapshot(true);
|
||||
}
|
||||
// hint
|
||||
auto hint = parse_node.children_[1];
|
||||
if (hint) {
|
||||
start_stmt->set_hint(ObString(hint->str_len_, hint->str_value_));
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}/* ns sql*/
|
||||
}/* ns oceanbase */
|
||||
|
||||
@ -17,21 +17,24 @@
|
||||
#include "sql/resolver/tcl/ob_tcl_resolver.h"
|
||||
#include "sql/resolver/tcl/ob_start_trans_stmt.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObStartTransResolver : public ObTCLResolver {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObStartTransResolver : public ObTCLResolver
|
||||
{
|
||||
public:
|
||||
explicit ObStartTransResolver(ObResolverParams& params);
|
||||
explicit ObStartTransResolver(ObResolverParams ¶ms);
|
||||
virtual ~ObStartTransResolver();
|
||||
|
||||
virtual int resolve(const ParseNode& parse_node);
|
||||
|
||||
virtual int resolve(const ParseNode &parse_node);
|
||||
private:
|
||||
/* functions */
|
||||
/* variables */
|
||||
DISALLOW_COPY_AND_ASSIGN(ObStartTransResolver);
|
||||
};
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}
|
||||
}
|
||||
#endif /* OCEANBASE_RESOLVER_TCL_START_TRANS_RESOLVER_ */
|
||||
//// end of header file
|
||||
|
||||
|
||||
@ -13,41 +13,50 @@
|
||||
#ifndef _OB_START_TRANS_STMT_H
|
||||
#define _OB_START_TRANS_STMT_H
|
||||
#include "sql/resolver/tcl/ob_tcl_stmt.h"
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObStartTransStmt : public ObTCLStmt {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObStartTransStmt: public ObTCLStmt
|
||||
{
|
||||
public:
|
||||
ObStartTransStmt();
|
||||
virtual ~ObStartTransStmt();
|
||||
virtual void print(FILE* fp, int32_t level, int32_t index);
|
||||
virtual void print(FILE *fp, int32_t level, int32_t index);
|
||||
void set_read_only(bool val);
|
||||
bool get_read_only() const;
|
||||
void set_with_consistent_snapshot(bool val);
|
||||
bool get_with_consistent_snapshot() const;
|
||||
virtual bool cause_implicit_commit() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
TO_STRING_KV(N_STMT_TYPE, ((int)stmt_type_), K_(read_only), K_(with_consistent_snapshot));
|
||||
|
||||
virtual bool cause_implicit_commit() const { return true; }
|
||||
const ObString &get_hint() const { return hint_; }
|
||||
void set_hint(const ObString hint) { hint_ = hint; }
|
||||
TO_STRING_KV(N_STMT_TYPE, ((int)stmt_type_),
|
||||
K_(read_only),
|
||||
K_(with_consistent_snapshot),
|
||||
K_(hint));
|
||||
private:
|
||||
// types and constants
|
||||
private:
|
||||
// disallow copy
|
||||
ObStartTransStmt(const ObStartTransStmt& other);
|
||||
ObStartTransStmt& operator=(const ObStartTransStmt& other);
|
||||
ObStartTransStmt(const ObStartTransStmt &other);
|
||||
ObStartTransStmt &operator=(const ObStartTransStmt &other);
|
||||
// function members
|
||||
private:
|
||||
// data members
|
||||
bool with_consistent_snapshot_;
|
||||
bool read_only_;
|
||||
ObString hint_;
|
||||
};
|
||||
|
||||
inline ObStartTransStmt::ObStartTransStmt()
|
||||
: ObTCLStmt(stmt::T_START_TRANS), with_consistent_snapshot_(false), read_only_(false)
|
||||
{}
|
||||
: ObTCLStmt(stmt::T_START_TRANS),
|
||||
with_consistent_snapshot_(false),
|
||||
read_only_(false), hint_()
|
||||
{
|
||||
}
|
||||
inline ObStartTransStmt::~ObStartTransStmt()
|
||||
{}
|
||||
{
|
||||
}
|
||||
inline void ObStartTransStmt::set_read_only(bool val)
|
||||
{
|
||||
read_only_ = val;
|
||||
@ -64,7 +73,7 @@ inline bool ObStartTransStmt::get_with_consistent_snapshot() const
|
||||
{
|
||||
return with_consistent_snapshot_;
|
||||
}
|
||||
inline void ObStartTransStmt::print(FILE* fp, int32_t level, int32_t index)
|
||||
inline void ObStartTransStmt::print(FILE *fp, int32_t level, int32_t index)
|
||||
{
|
||||
print_indentation(fp, level);
|
||||
fprintf(fp, "<ObStartTransStmt id=%d>\n", index);
|
||||
@ -73,7 +82,7 @@ inline void ObStartTransStmt::print(FILE* fp, int32_t level, int32_t index)
|
||||
print_indentation(fp, level);
|
||||
fprintf(fp, "</ObStartTransStmt>\n");
|
||||
}
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
} // end namespace sql
|
||||
} // end namespace oceanbase
|
||||
|
||||
#endif // _OB_START_TRANS_STMT_H
|
||||
#endif // _OB_START_TRANS_STMT_H
|
||||
|
||||
@ -12,35 +12,43 @@
|
||||
|
||||
#include "sql/resolver/tcl/ob_tcl_resolver.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace oceanbase
|
||||
{
|
||||
using namespace common;
|
||||
using namespace share::schema;
|
||||
namespace sql {
|
||||
namespace sql
|
||||
{
|
||||
|
||||
ObTCLResolver::ObTCLResolver(ObResolverParams& params) : ObStmtResolver(params)
|
||||
{}
|
||||
|
||||
ObTCLResolver::ObTCLResolver(ObResolverParams ¶ms)
|
||||
: ObStmtResolver(params)
|
||||
{
|
||||
}
|
||||
|
||||
ObTCLResolver::~ObTCLResolver()
|
||||
{}
|
||||
{
|
||||
}
|
||||
|
||||
int ObTCLResolver::resolve_special_expr(ObRawExpr*& expr, ObStmtScope scope)
|
||||
int ObTCLResolver::resolve_special_expr(ObRawExpr *&expr, ObStmtScope scope)
|
||||
{
|
||||
UNUSED(expr);
|
||||
UNUSED(scope);
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
int ObTCLResolver::resolve_sub_query_info(const ObIArray<ObSubQueryInfo>& subquery_info, const ObStmtScope upper_scope)
|
||||
int ObTCLResolver::resolve_sub_query_info(const ObIArray<ObSubQueryInfo> &subquery_info,
|
||||
const ObStmtScope upper_scope)
|
||||
{
|
||||
UNUSED(subquery_info);
|
||||
UNUSED(upper_scope);
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
int ObTCLResolver::resolve_columns(ObRawExpr*& expr, ObArray<ObQualifiedName>& columns)
|
||||
int ObTCLResolver::resolve_columns(ObRawExpr *&expr, ObArray<ObQualifiedName> &columns)
|
||||
{
|
||||
UNUSED(expr);
|
||||
UNUSED(columns);
|
||||
return OB_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
|
||||
@ -15,26 +15,28 @@
|
||||
|
||||
#include "sql/resolver/ob_stmt_resolver.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
|
||||
class ObTCLResolver : public ObStmtResolver {
|
||||
class ObTCLResolver : public ObStmtResolver
|
||||
{
|
||||
public:
|
||||
explicit ObTCLResolver(ObResolverParams& params);
|
||||
explicit ObTCLResolver(ObResolverParams ¶ms);
|
||||
virtual ~ObTCLResolver();
|
||||
|
||||
virtual int resolve_special_expr(ObRawExpr*& expr, ObStmtScope scope);
|
||||
virtual int resolve_sub_query_info(
|
||||
const common::ObIArray<ObSubQueryInfo>& subquery_info, const ObStmtScope upper_scope);
|
||||
virtual int resolve_columns(ObRawExpr*& expr, common::ObArray<ObQualifiedName>& columns);
|
||||
|
||||
virtual int resolve_special_expr(ObRawExpr *&expr, ObStmtScope scope);
|
||||
virtual int resolve_sub_query_info(const common::ObIArray<ObSubQueryInfo> &subquery_info,
|
||||
const ObStmtScope upper_scope);
|
||||
virtual int resolve_columns(ObRawExpr *&expr, common::ObArray<ObQualifiedName> &columns);
|
||||
private:
|
||||
/* functions */
|
||||
/* variables */
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTCLResolver);
|
||||
};
|
||||
|
||||
} // namespace sql
|
||||
} // namespace oceanbase
|
||||
}
|
||||
}
|
||||
#endif /* OCEANBASE_SQL_TCL_RESOLVER_ */
|
||||
//// end of header file
|
||||
|
||||
@ -15,21 +15,22 @@
|
||||
#include "share/ob_rpc_struct.h"
|
||||
#include "sql/resolver/ob_stmt.h"
|
||||
#include "sql/resolver/ob_cmd.h"
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObTCLStmt : public ObStmt, public ObICmd {
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace sql
|
||||
{
|
||||
class ObTCLStmt : public ObStmt, public ObICmd
|
||||
{
|
||||
public:
|
||||
ObTCLStmt(common::ObIAllocator* name_pool, stmt::StmtType type) : ObStmt(name_pool, type)
|
||||
{}
|
||||
explicit ObTCLStmt(stmt::StmtType type) : ObStmt(type)
|
||||
{}
|
||||
virtual ~ObTCLStmt()
|
||||
{}
|
||||
virtual int get_cmd_type() const
|
||||
ObTCLStmt(common::ObIAllocator *name_pool, stmt::StmtType type)
|
||||
: ObStmt(name_pool, type)
|
||||
{
|
||||
return get_stmt_type();
|
||||
}
|
||||
|
||||
explicit ObTCLStmt(stmt::StmtType type): ObStmt(type)
|
||||
{
|
||||
}
|
||||
virtual ~ObTCLStmt() {}
|
||||
virtual int get_cmd_type() const { return get_stmt_type(); }
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObTCLStmt);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user