Skip to content

Commit

Permalink
Reflects some of the code review content.
Browse files Browse the repository at this point in the history
  • Loading branch information
jongmin-won committed Dec 21, 2024
1 parent 0fcb37d commit ca10800
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
11 changes: 2 additions & 9 deletions src/executables/unload_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -4532,16 +4532,9 @@ emit_stored_procedure_pre (extract_context & ctxt, print_output & output_ctx)
}

// dtrm_type
if (sp_type == SP_TYPE_FUNCTION)
if (directive & SP_DIRECTIVE_ENUM::SP_DIRECTIVE_DETERMINISTIC)
{
if (directive & SP_DIRECTIVE_ENUM::SP_DIRECTIVE_RIGHTS_DETERMINISTIC)
{
output_ctx ("DETERMINISTIC ");
}
else
{
output_ctx ("NOT DETERMINISTIC ");
}
output_ctx ("DETERMINISTIC ");
}

int sp_lang = db_get_int (&lang_val);
Expand Down
2 changes: 1 addition & 1 deletion src/object/schema_system_catalog_install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,7 @@ namespace cubschema
{"arg_count", "integer"},
{"lang", "varchar(16)"},
{"authid", "varchar(16)"},
{"dtrm_type", "varchar(20)"},
{"is_deterministic", "varchar(3)"},
{"target", "varchar(4096)"},
{"owner", "varchar(256)"},
{"code", format_varchar (1073741823)},
Expand Down
2 changes: 1 addition & 1 deletion src/object/schema_system_catalog_install_query_spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ sm_define_view_stored_procedure_spec (void)
"[sp].[arg_count] AS [arg_count], "
"CASE [sp].[lang] WHEN 0 THEN 'PLCSQL' WHEN 1 THEN 'JAVA' ELSE 'UNKNOWN' END AS [lang], "
"CASE [sp].[directive] & 1 WHEN 0 THEN 'DEFINER' ELSE 'CURRENT_USER' END AS [authid], "
"CASE [sp].[directive] & 2 WHEN 0 THEN 'NOT DETERMINISTIC' ELSE 'DETERMINISTIC' END AS [dtrm_type], "
"CASE [sp].[directive] & 2 WHEN 0 THEN 'NO' ELSE 'YES' END AS [deterministic], "
"CONCAT ([sp].[target_class], '.', [sp].[target_method]) AS [target], "
"CAST ([sp].[owner].[name] AS VARCHAR(255)) AS [owner], " /* string -> varchar(255) */
"[sp_code].[scode] AS [code], "
Expand Down
6 changes: 4 additions & 2 deletions src/parser/xasl_generation.c
Original file line number Diff line number Diff line change
Expand Up @@ -27624,18 +27624,20 @@ pt_make_sq_cache_key_struct (QPROC_DB_VALUE_LIST key_struct, void *p, int type)
}
break;
case TYPE_SP:
regu_var_list_p = regu_src->value.sp_ptr->args;

/* The value of regu_src->value.sp_ptr->sig->is_deterministic is interpreted as follows
* 0: PT_AUTHID_OWNER + PT_NOT_DETERMINISTIC
* 1: PT_AUTHID_CALLER + PT_NOT_DETERMINISTIC
* 2: PT_AUTHID_OWNER + PT_DETERMINISTIC
* 3: PT_AUTHID_CALLER + PT_DETERMINISTIC
*/
#if defined (CS_MODE)
if (regu_src->value.sp_ptr->sig->is_deterministic == false)
{
return ER_FAILED;
}
#endif

regu_var_list_p = regu_src->value.sp_ptr->args;

while (regu_var_list_p)
{
Expand Down
6 changes: 4 additions & 2 deletions src/sp/jsp_cl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,7 @@ jsp_map_pt_to_sp_dtrm_type (PT_MISC_TYPE pt_dtrm_type, SP_DIRECTIVE_ENUM directi
if (pt_dtrm_type == PT_DETERMINISTIC)
{
directive = static_cast<SP_DIRECTIVE_ENUM> (static_cast<int> (directive) | static_cast<int>
(SP_DIRECTIVE_ENUM::SP_DIRECTIVE_RIGHTS_DETERMINISTIC));
(SP_DIRECTIVE_ENUM::SP_DIRECTIVE_DETERMINISTIC));
}

return directive;
Expand Down Expand Up @@ -2113,15 +2113,17 @@ jsp_make_pl_signature (PARSER_CONTEXT *parser, PT_NODE *node, PT_NODE *subquery_
goto exit;
}

#if defined (CS_MODE)
sig.auth = db_private_strdup (NULL, auth_name);
if ((directive & SP_DIRECTIVE_ENUM::SP_DIRECTIVE_RIGHTS_DETERMINISTIC))
if (directive & SP_DIRECTIVE_ENUM::SP_DIRECTIVE_DETERMINISTIC)
{
sig.is_deterministic = true;
}
else
{
sig.is_deterministic = false;
}
#endif

sig.result_type = result_type;
if (! (directive & SP_DIRECTIVE_ENUM::SP_DIRECTIVE_RIGHTS_CALLER))
Expand Down
5 changes: 4 additions & 1 deletion src/sp/pl_signature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ namespace cubpl
int type; // PL_TYPE
char *name;
char *auth;
bool is_deterministic; // DETERMINISTIC
int result_type; // DB_TYPE

#if defined (CS_MODE)
bool is_deterministic; // DETERMINISTIC
#endif

pl_arg arg;
pl_ext ext;

Expand Down
2 changes: 1 addition & 1 deletion src/sp/sp_catalog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ enum sp_directive : int
{
SP_DIRECTIVE_RIGHTS_OWNER = 0x00,
SP_DIRECTIVE_RIGHTS_CALLER = (0x01 << 0),
SP_DIRECTIVE_RIGHTS_DETERMINISTIC = (0x01 << 1),
SP_DIRECTIVE_DETERMINISTIC = (0x01 << 1),
};
typedef sp_directive SP_DIRECTIVE_ENUM;

Expand Down

0 comments on commit ca10800

Please sign in to comment.