mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch '10.6' into 10.9
This commit is contained in:
@@ -116,7 +116,7 @@ static my_bool opt_compress= 0, silent= 0, verbose= 0;
|
||||
static my_bool debug_info_flag= 0, debug_check_flag= 0;
|
||||
static my_bool tty_password= 0;
|
||||
static my_bool opt_mark_progress= 0;
|
||||
static my_bool ps_protocol= 0, ps_protocol_enabled= 0;
|
||||
static my_bool ps_protocol= 0, ps_protocol_enabled= 0, ps2_protocol_enabled= 0;
|
||||
static my_bool sp_protocol= 0, sp_protocol_enabled= 0;
|
||||
static my_bool view_protocol= 0, view_protocol_enabled= 0;
|
||||
static my_bool service_connection_enabled= 1;
|
||||
@@ -157,6 +157,7 @@ static struct property prop_list[] = {
|
||||
{ &display_session_track_info, 0, 1, 1, "$ENABLED_STATE_CHANGE_INFO" },
|
||||
{ &display_metadata, 0, 0, 0, "$ENABLED_METADATA" },
|
||||
{ &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" },
|
||||
{ &ps2_protocol_enabled, 0, 0, 0, "$ENABLED_PS2_PROTOCOL" },
|
||||
{ &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"},
|
||||
{ &service_connection_enabled, 0, 1, 0, "$ENABLED_SERVICE_CONNECTION"},
|
||||
{ &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" },
|
||||
@@ -173,6 +174,7 @@ enum enum_prop {
|
||||
P_SESSION_TRACK,
|
||||
P_META,
|
||||
P_PS,
|
||||
P_PS2,
|
||||
P_VIEW,
|
||||
P_CONN,
|
||||
P_QUERY,
|
||||
@@ -263,6 +265,7 @@ static size_t suite_dir_len, overlay_dir_len;
|
||||
|
||||
/* Precompiled re's */
|
||||
static regex_t ps_re; /* the query can be run using PS protocol */
|
||||
static regex_t ps2_re; /* the query can be run using PS protocol with second execution*/
|
||||
static regex_t sp_re; /* the query can be run as a SP */
|
||||
static regex_t view_re; /* the query can be run as a view*/
|
||||
|
||||
@@ -381,6 +384,7 @@ enum enum_commands {
|
||||
Q_LOWERCASE,
|
||||
Q_START_TIMER, Q_END_TIMER,
|
||||
Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL,
|
||||
Q_DISABLE_PS2_PROTOCOL, Q_ENABLE_PS2_PROTOCOL,
|
||||
Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL,
|
||||
Q_DISABLE_SERVICE_CONNECTION, Q_ENABLE_SERVICE_CONNECTION,
|
||||
Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API,
|
||||
@@ -474,6 +478,8 @@ const char *command_names[]=
|
||||
"character_set",
|
||||
"disable_ps_protocol",
|
||||
"enable_ps_protocol",
|
||||
"disable_ps2_protocol",
|
||||
"enable_ps2_protocol",
|
||||
"disable_view_protocol",
|
||||
"enable_view_protocol",
|
||||
"disable_service_connection",
|
||||
@@ -7387,7 +7393,7 @@ int parse_args(int argc, char **argv)
|
||||
if (argc == 1)
|
||||
opt_db= *argv;
|
||||
if (tty_password)
|
||||
opt_pass= get_tty_password(NullS); /* purify tested */
|
||||
opt_pass= my_get_tty_password(NullS); /* purify tested */
|
||||
if (debug_info_flag)
|
||||
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
|
||||
if (debug_check_flag)
|
||||
@@ -8475,6 +8481,19 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Execute the query first time if second execution enable
|
||||
*/
|
||||
if(ps2_protocol_enabled && match_re(&ps2_re, query))
|
||||
{
|
||||
if (do_stmt_execute(cn))
|
||||
{
|
||||
handle_error(command, mysql_stmt_errno(stmt),
|
||||
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Execute the query
|
||||
*/
|
||||
@@ -9084,6 +9103,9 @@ int util_query(MYSQL* org_mysql, const char* query){
|
||||
org_mysql->unix_socket);
|
||||
|
||||
cur_con->util_mysql= mysql;
|
||||
if (mysql->charset != org_mysql->charset)
|
||||
mysql_set_character_set(mysql, org_mysql->charset->
|
||||
IF_EMBEDDED(cs_name.str, csname));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -9463,6 +9485,13 @@ void init_re(void)
|
||||
"[[:space:]]*UNINSTALL[[:space:]]+|"
|
||||
"[[:space:]]*UPDATE[[:space:]]"
|
||||
")";
|
||||
/*
|
||||
Filter for queries that can be run for second
|
||||
execution of prepare statement
|
||||
*/
|
||||
const char *ps2_re_str =
|
||||
"^("
|
||||
"[[:space:]]*SELECT[[:space:]])";
|
||||
|
||||
/*
|
||||
Filter for queries that can be run as views
|
||||
@@ -9472,6 +9501,7 @@ void init_re(void)
|
||||
"[[:space:]]*SELECT[[:space:]])";
|
||||
|
||||
init_re_comp(&ps_re, ps_re_str);
|
||||
init_re_comp(&ps2_re, ps2_re_str);
|
||||
init_re_comp(&sp_re, sp_re_str);
|
||||
init_re_comp(&view_re, view_re_str);
|
||||
}
|
||||
@@ -9508,6 +9538,7 @@ int match_re(regex_t *re, char *str)
|
||||
void free_re(void)
|
||||
{
|
||||
regfree(&ps_re);
|
||||
regfree(&ps2_re);
|
||||
regfree(&sp_re);
|
||||
regfree(&view_re);
|
||||
}
|
||||
@@ -9859,6 +9890,9 @@ int main(int argc, char **argv)
|
||||
if (cursor_protocol)
|
||||
ps_protocol= 1;
|
||||
|
||||
/* Enable second execution of SELECT for ps-protocol
|
||||
if ps-protocol is used */
|
||||
ps2_protocol_enabled= ps_protocol;
|
||||
ps_protocol_enabled= ps_protocol;
|
||||
sp_protocol_enabled= sp_protocol;
|
||||
view_protocol_enabled= view_protocol;
|
||||
@@ -10286,6 +10320,12 @@ int main(int argc, char **argv)
|
||||
case Q_ENABLE_PS_PROTOCOL:
|
||||
set_property(command, P_PS, ps_protocol);
|
||||
break;
|
||||
case Q_DISABLE_PS2_PROTOCOL:
|
||||
set_property(command, P_PS2, 0);
|
||||
break;
|
||||
case Q_ENABLE_PS2_PROTOCOL:
|
||||
set_property(command, P_PS2, ps_protocol);
|
||||
break;
|
||||
case Q_DISABLE_VIEW_PROTOCOL:
|
||||
set_property(command, P_VIEW, 0);
|
||||
/* Close only util connections */
|
||||
|
Reference in New Issue
Block a user