[FEAT MERGE]:Oracle Json Supported

This commit is contained in:
obdev
2023-01-28 15:52:29 +08:00
committed by ob-robot
parent 274e68514d
commit bbb017266b
197 changed files with 30520 additions and 2252 deletions

View File

@ -28,6 +28,8 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
* Oracle Non-Reserved/Reserved Keywords
* 添加新的非保留关键字请从OB Non-Reserved Keywords处开始添加,前面是兼容oracle的保留关键字及非保留关键字!!!
* */
{"absent", ABSENT},
{"access", ACCESS},
{"accessed", ACCESSED},
{"add", ADD},
@ -225,6 +227,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"own", OWN},
{"package", PACKAGE_KEY},
{"parallel", PARALLEL},
{"passing", PASSING},
{"password_lock_time", PASSWORD_LOCK_TIME},
{"password_verify_function", PASSWORD_VERIFY_FUNCTION},
{"pctincrease", PCTINCREASE},
@ -349,9 +352,11 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"against", AGAINST},
{"aggregate", AGGREGATE},
{"algorithm", ALGORITHM},
{"allow", ALLOW},
{"always", ALWAYS},
{"analyse", ANALYSE},
{"any", ANY},
{"array", ARRAY},
{"approx_count_distinct", APPROX_COUNT_DISTINCT},
{"approx_count_distinct_synopsis", APPROX_COUNT_DISTINCT_SYNOPSIS},
{"approx_count_distinct_synopsis_merge", APPROX_COUNT_DISTINCT_SYNOPSIS_MERGE},
@ -424,6 +429,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"compression", COMPRESSION},
{"compute", COMPUTE},
{"concurrent", CONCURRENT},
{"conditional", CONDITIONAL},
{"connect", CONNECT},
{"connection", CONNECTION},
{"consistent", CONSISTENT},
@ -474,11 +480,13 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"diagnostics", DIAGNOSTICS},
{"dictionary", DICTIONARY},
{"directory", DIRECTORY},
{"disallow", DISALLOW},
{"discard", DISCARD},
{"disk", DISK},
{"distinctrow", DISTINCTROW},
{"div", DIV},
{"do", DO},
{"dot", DOT},
{"dual", DUAL},
{"dumpfile", DUMPFILE},
{"duplicate", DUPLICATE},
@ -513,6 +521,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"extended", EXTENDED},
{"extended_noaddr", EXTENDED_NOADDR},
{"extent_size", EXTENT_SIZE},
{"extra", EXTRA},
{"extract", EXTRACT},
{"fast", FAST},
{"failed_login_attempts", FAILED_LOGIN_ATTEMPTS},
@ -610,6 +619,16 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"job", JOB},
{"join", JOIN},
{"json", JSON},
{"json_array", JSON_ARRAY},
{"json_equal", JSON_EQUAL},
{"json_exists", JSON_EXISTS},
{"json_value", JSON_VALUE},
{"json_query", JSON_QUERY},
{"json_mergepatch", JSON_MERGEPATCH},
{"json_arrayagg", JSON_ARRAYAGG},
{"json_objectagg", JSON_OBJECTAGG},
{"json_table", JSON_TABLE},
{"json_object", JSON_OBJECT},
{"k", K},
{"key_block_size", KEY_BLOCK_SIZE},
{"keys", KEYS},
@ -621,6 +640,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"lag", LAG},
{"last", LAST},
{"last_value", LAST_VALUE},
{"lax", LAX},
{"lead", LEAD},
{"leader", LEADER},
{"leading", LEADING},
@ -714,6 +734,8 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"minute", MINUTE},
{"minute_microsecond", MINUTE_MICROSECOND},
{"minute_second", MINUTE_SECOND},
{"mismatch", MISMATCH},
{"missing", MISSING},
{"mod", MOD},
{"modifies", MODIFIES},
{"month", MONTH},
@ -734,6 +756,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"nchar_cs", NCHAR_CS},
{"ndb", NDB},
{"ndbcluster", NDBCLUSTER},
{"nested", NESTED},
{"no", NO},
{"no_parallel", NO_PARALLEL},
{"no_rewrite", NO_REWRITE},
@ -750,6 +773,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"nth_value", NTH_VALUE},
{"object", OBJECT},
{"occur", OCCUR},
{"ordinality", ORDINALITY},
{"offset", OFFSET},
{"old_key", OLD_KEY},
{"over", OVER},
@ -783,6 +807,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"password_life_time", PASSWORD_LIFE_TIME},
{"password_lock_time", PASSWORD_LOCK_TIME},
{"password_verify_function", PASSWORD_VERIFY_FUNCTION},
{"path", PATH},
{"pause", PAUSE},
{"percent", PERCENT},
{"percentage", PERCENTAGE},
@ -895,6 +920,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"run", RUN},
{"sample", SAMPLE},
{"search", SEARCH},
{"scalars", SCALARS},
{"schedule", SCHEDULE},
{"schema", SCHEMAS},
{"schema_name", SCHEMA_NAME},
@ -939,6 +965,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"stddev", STDDEV},
{"stddev_pop", STDDEV_POP},
{"stddev_samp", STDDEV_SAMP},
{"strict", STRICT},
{"spfile", SPFILE},
{"split", SPLIT},
{"sqlexception", SQLEXCEPTION},
@ -1029,9 +1056,12 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"translate", TRANSLATE},
{"trigger", TRIGGER},
{"trim", TRIM},
{"treat", TREAT},
{"type", TYPE},
{"typename", TYPENAME},
{"types", TYPES},
{"uncommitted", UNCOMMITTED},
{"unconditional", UNCONDITIONAL},
{"undefined", UNDEFINED},
{"undo", UNDO},
{"undo_buffer_size", UNDO_BUFFER_SIZE},
@ -1056,6 +1086,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"unbounded", UNBOUNDED},
{"urowid", UROWID},
{"valid", VALID},
{"value", VALUE},
{"var_pop", VAR_POP},
{"var_samp", VAR_SAMP},
{"varcharacter", VARCHAR},
@ -1071,6 +1102,7 @@ static const NonReservedKeyword Oracle_non_reserved_keywords[] =
{"weak", WEAK},
{"week", WEEK},
{"weight_string", WEIGHT_STRING},
{"without", WITHOUT},
{"wmsys", WMSYS},
{"wm_concat", WM_CONCAT},
{"wrapper", WRAPPER},

View File

@ -235,7 +235,7 @@ namespace sql
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
// [+&~|^/%*(),.!=<>]
// [+&~|^/%*(),.!=<>{}]
static const bool ORACLE_NORMAL_CHAR_FLAGS[256] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -244,7 +244,7 @@ namespace sql
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,
0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@ -144,6 +144,7 @@ typedef struct _ParseNode
uint32_t is_empty_ : 1; // 表示是否缺省该节点,1表示缺省,0表示没有缺省, opt_asc_desc节点中使用到
uint32_t is_multiset_ : 1; // for cast(multiset(...) as ...)
uint32_t is_forbid_anony_parameter_ : 1; // 1 表示禁止匿名块参数化
uint32_t is_input_quoted : 1; // indicate name_ob input whether with double quote
uint32_t reserved_;
};
};

View File

@ -485,7 +485,7 @@ END_P SET_VAR DELIMITER
%type <node> opt_sql_throttle_for_priority opt_sql_throttle_using_cond sql_throttle_one_or_more_metrics sql_throttle_metric
%type <node> opt_copy_id opt_backup_dest opt_preview opt_backup_backup_dest opt_tenant_info opt_with_active_piece get_format_unit opt_backup_tenant_list opt_backup_to opt_description policy_name opt_recovery_window opt_redundancy opt_backup_copies opt_restore_until
%type <node> new_or_old new_or_old_column_ref diagnostics_info_ref
%type <node> on_empty on_error json_on_response opt_returning_type opt_on_empty_or_error json_value_expr
%type <node> on_empty on_error json_on_response opt_returning_type opt_on_empty_or_error json_value_expr opt_ascii
%type <node> ws_nweights opt_ws_as_char opt_ws_levels ws_level_flag_desc ws_level_flag_reverse ws_level_flags ws_level_list ws_level_list_item ws_level_number ws_level_range ws_level_list_or_range
%type <node> get_diagnostics_stmt get_statement_diagnostics_stmt get_condition_diagnostics_stmt statement_information_item_list condition_information_item_list statement_information_item condition_information_item statement_information_item_name condition_information_item_name condition_arg
%type <node> method_opt method_list method extension
@ -16249,11 +16249,38 @@ DAY
*===========================================================*/
json_value_expr:
JSON_VALUE '(' simple_expr ',' complex_string_literal opt_returning_type opt_on_empty_or_error ')'
JSON_VALUE '(' simple_expr ',' complex_string_literal opt_returning_type opt_ascii opt_on_empty_or_error ')'
{
ParseNode *empty_value = $7->children_[1];
ParseNode *error_value = $7->children_[3];
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS_JSON_VALUE, 7, $3, $5, $6, $7->children_[0], empty_value, $7->children_[2], error_value);
ParseNode *empty_value = $8->children_[1];
ParseNode *error_value = $8->children_[3];
ParseNode *on_mismatch = NULL;
malloc_terminal_node(on_mismatch, result->malloc_pool_, T_INT);
on_mismatch->value_ = 3;
on_mismatch->is_hidden_const_ = 1;
ParseNode *mismatch_type = NULL;
malloc_terminal_node(mismatch_type, result->malloc_pool_, T_INT);
mismatch_type->value_ = 3;
mismatch_type->is_hidden_const_ = 1;
ParseNode *mismatch_options = NULL;
malloc_non_terminal_node(mismatch_options, result->malloc_pool_, T_LINK_NODE, 2, on_mismatch, mismatch_type);
malloc_non_terminal_node($$, result->malloc_pool_, T_FUN_SYS_JSON_VALUE, 9, $3, $5, $6, $7, $8->children_[0], empty_value, $8->children_[2], error_value, mismatch_options);
}
;
opt_ascii:
{
malloc_terminal_node($$, result->malloc_pool_, T_INT);
$$->value_ = 0;
$$->is_hidden_const_ = 1;
}
| ASCII
{
malloc_terminal_node($$, result->malloc_pool_, T_INT);
$$->value_ = 1;
$$->is_hidden_const_ = 1;
}
;