fix mysqltest

This commit is contained in:
obdev
2024-02-09 09:15:38 +00:00
committed by ob-robot
parent fabef328ba
commit 4656d6cb08
4 changed files with 17 additions and 3 deletions

View File

@ -1768,6 +1768,10 @@ int ObPL::execute(ObExecContext &ctx, ParamStore &params, const ObStmtNodeTree *
// stmt_id is OB_INVALID_ID for anonymous block from text protocol
OZ (compiler.compile(block, OB_INVALID_ID, *routine, &params, false));
OX (routine->set_debug_priv());
if (OB_SUCC(ret) && params.count() != routine->get_params_info().count()) {
ret = OB_ERR_BIND_VARIABLE_NOT_EXIST;
LOG_WARN("text anonymous can not contain bind variable", K(ret));
}
}
}
// restore work timeout
@ -2443,7 +2447,7 @@ int ObPL::generate_pl_function(ObExecContext &ctx,
OZ (compiler.compile(
block_node, stmt_id, *routine, &params, ctx.get_sql_ctx()->is_prepare_protocol_));
OZ (routine->set_params_info(params));
OZ (routine->set_params_info(params, true));
}
int64_t compile_end = ObTimeUtility::current_time();

View File

@ -747,6 +747,9 @@ int ObPLObjectValue::match_param_info(const ObPlParamInfo &param_info,
is_same = false;
} else {
is_same = (param.get_scale() == param_info.scale_);
if (is_same && param.is_number() && PL_INTEGER_TYPE == param_info.pl_type_) {
is_same = param.get_number().is_valid_int();
}
}
}
if (is_same && param_info.flag_.need_to_check_bool_value_) {

View File

@ -40,7 +40,7 @@ void ObPLCacheObject::reset()
expressions_.reset();
}
int ObPLCacheObject::set_params_info(const ParamStore &params)
int ObPLCacheObject::set_params_info(const ParamStore &params, bool is_anonymous)
{
int ret = OB_SUCCESS;
int64_t N = params.count();
@ -95,6 +95,13 @@ int ObPLCacheObject::set_params_info(const ParamStore &params)
LOG_DEBUG("ext params info", K(data_type), K(param_info), K(params.at(i)));
} else {
param_info.scale_ = params.at(i).get_scale();
if (is_anonymous) {
ObPLFunction *func = static_cast<ObPLFunction *>(this);
if (func->get_variables().count() > i &&
func->get_variables().at(i).is_pl_integer_type()) {
param_info.pl_type_ = PL_INTEGER_TYPE;
}
}
}
if (OB_SUCC(ret)) {
if (OB_FAIL(params_info_.push_back(param_info))) {

View File

@ -89,7 +89,7 @@ public:
inline const sql::DependenyTableStore &get_dependency_table() const { return dependency_tables_; }
int init_dependency_table_store(int64_t dependency_table_cnt) { return dependency_tables_.init(dependency_table_cnt); }
inline sql::DependenyTableStore &get_dependency_table() { return dependency_tables_; }
int set_params_info(const ParamStore &params);
int set_params_info(const ParamStore &params, bool is_anonymous = false);
const common::Ob2DArray<ObPlParamInfo,
common::OB_MALLOC_BIG_BLOCK_SIZE,
common::ObWrapperAllocator, false> &get_params_info() const { return params_info_; }