[to #2024082100104212762] fix: fix core dump when ? in DBMS_SQL.PARSER

This commit is contained in:
0xacc
2024-08-23 07:09:33 +00:00
committed by ob-robot
parent dc6978c815
commit 06bbec1303
4 changed files with 34 additions and 6 deletions

View File

@ -596,13 +596,21 @@ int ObDbmsCursorInfo::parse(const ObString &sql_stmt, ObSQLSessionInfo &session)
session.get_warnings_buffer().set_error_line_column(0, error_offset);
}
OZ (ObResolverUtils::resolve_stmt_type(parse_result, stmt_type_), sql_stmt);
// cann't execute multi select stmt
if (OB_SUCC(ret)
&& !parser.is_pl_stmt(sql_stmt)
&& !parser.is_single_stmt(sql_stmt)) {
if (OB_FAIL(ret)) {
// do nothing
} else if (!parser.is_pl_stmt(sql_stmt)
&& !parser.is_single_stmt(sql_stmt)) {
// cann't execute multi select stmt
ret = OB_ERR_CMD_NOT_PROPERLY_ENDED;
LOG_WARN("execute immdeidate only support one stmt", K(ret));
} else if (0 < parse_result.question_mark_ctx_.count_
&&!parse_result.question_mark_ctx_.by_name_) {
ret = OB_ERR_INVALID_CHARACTER;
LOG_WARN("use '?' in DBMS_SQL.PARSE is not supported",
K(ret), K(sql_stmt));
}
OX (param_names = parse_result.question_mark_ctx_.name_);
OX (param_count = parse_result.question_mark_ctx_.count_);
// 取出所有绑定变量名

File diff suppressed because one or more lines are too long

View File

@ -2643,6 +2643,7 @@ DEFINE_ERROR(OB_ERR_EVENT_CANNOT_CREATE_IN_THE_PAST, -9778, ER_EVENT_CANNOT_CREA
DEFINE_ERROR(OB_ERR_EVENT_CANNOT_ALTER_IN_THE_PAST, -9779, ER_EVENT_CANNOT_ALTER_IN_THE_PAST, "HY000", "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.");
DEFINE_ERROR(OB_ERR_EVENT_RECURSION_FORBIDDEN, -9780, ER_EVENT_RECURSION_FORBIDDEN, "HY000", "Recursion of EVENT DDL statements is forbidden when body is present");
DEFINE_ORACLE_ERROR(OB_NO_PARTITION_FOR_GIVEN_VALUE_SCHEMA_ERROR, -9781, ER_NO_PARTITION_FOR_GIVEN_VALUE, "HY000", "Table has no partition for value", 14400, "inserted partition key does not map to any partition");
DEFINE_ORACLE_ERROR(OB_ERR_INVALID_CHARACTER, -9782, -1, "HY000", "invalid character", 911, "invalid character");
// 余留位置
////////////////////////////////////////////////////////////////
// PL/SQL错误码值域 [-9500, -10000)

View File

@ -1867,6 +1867,7 @@ constexpr int OB_ERR_EVENT_CANNOT_CREATE_IN_THE_PAST = -9778;
constexpr int OB_ERR_EVENT_CANNOT_ALTER_IN_THE_PAST = -9779;
constexpr int OB_ERR_EVENT_RECURSION_FORBIDDEN = -9780;
constexpr int OB_NO_PARTITION_FOR_GIVEN_VALUE_SCHEMA_ERROR = -9781;
constexpr int OB_ERR_INVALID_CHARACTER = -9782;
constexpr int OB_ERR_KV_GLOBAL_INDEX_ROUTE = -10500;
constexpr int OB_TTL_NOT_ENABLE = -10501;
constexpr int OB_TTL_COLUMN_NOT_EXIST = -10502;
@ -4169,6 +4170,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_EVENT_CANNOT_ALTER_IN_THE_PAST__USER_ERROR_MSG "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future."
#define OB_ERR_EVENT_RECURSION_FORBIDDEN__USER_ERROR_MSG "Recursion of EVENT DDL statements is forbidden when body is present"
#define OB_NO_PARTITION_FOR_GIVEN_VALUE_SCHEMA_ERROR__USER_ERROR_MSG "Table has no partition for value"
#define OB_ERR_INVALID_CHARACTER__USER_ERROR_MSG "invalid character"
#define OB_ERR_KV_GLOBAL_INDEX_ROUTE__USER_ERROR_MSG "incorrect route for obkv global index, client router should refresh."
#define OB_TTL_NOT_ENABLE__USER_ERROR_MSG "TTL feature is not enabled"
#define OB_TTL_COLUMN_NOT_EXIST__USER_ERROR_MSG "TTL column '%.*s' not exists"
@ -8745,6 +8747,8 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_EVENT_RECURSION_FORBIDDEN__OBE_USER_ERROR_MSG "OBE-00600: internal error code, arguments: -9780, Recursion of EVENT DDL statements is forbidden when body is present"
#define OB_NO_PARTITION_FOR_GIVEN_VALUE_SCHEMA_ERROR__ORA_USER_ERROR_MSG "ORA-14400: inserted partition key does not map to any partition"
#define OB_NO_PARTITION_FOR_GIVEN_VALUE_SCHEMA_ERROR__OBE_USER_ERROR_MSG "OBE-14400: inserted partition key does not map to any partition"
#define OB_ERR_INVALID_CHARACTER__ORA_USER_ERROR_MSG "ORA-00911: invalid character"
#define OB_ERR_INVALID_CHARACTER__OBE_USER_ERROR_MSG "OBE-00911: invalid character"
#define OB_ERR_KV_GLOBAL_INDEX_ROUTE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -10500, incorrect route for obkv global index, client router should refresh."
#define OB_ERR_KV_GLOBAL_INDEX_ROUTE__OBE_USER_ERROR_MSG "OBE-00600: internal error code, arguments: -10500, incorrect route for obkv global index, client router should refresh."
#define OB_TTL_NOT_ENABLE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -10501, TTL feature is not enabled"
@ -8906,7 +8910,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__OBE_USER_ERROR_MSG "OBE-01861: Incorrect datetime value for column '%.*s' at row %ld"
extern int g_all_ob_errnos[2325];
extern int g_all_ob_errnos[2326];
const char *ob_error_name(const int oberr);
const char* ob_error_cause(const int oberr);