1- /* Copyright (c) 2002, 2018 , Oracle and/or its affiliates. All rights reserved.
1+ /* Copyright (c) 2002, 2021 , Oracle and/or its affiliates. All rights reserved.
22
33 This program is free software; you can redistribute it and/or modify
44 it under the terms of the GNU General Public License, version 2.0,
@@ -2827,7 +2827,8 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
28272827
28282828 thd->stmt_arena = stmt;
28292829 thd->set_n_backup_statement (stmt, &stmt_backup);
2830-
2830+ int32 saved_safe_to_display = thd->safe_to_display ();
2831+ thd->set_safe_display (true );
28312832 cursor->fetch (num_rows);
28322833
28332834 if (!cursor->is_open ())
@@ -2837,6 +2838,7 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
28372838 }
28382839
28392840 thd->restore_backup_statement (stmt, &stmt_backup);
2841+ thd->set_safe_display (saved_safe_to_display);
28402842 thd->stmt_arena = thd;
28412843
28422844 DBUG_VOID_RETURN;
@@ -3407,11 +3409,14 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
34073409 */
34083410 thd->set_n_backup_statement (this , &stmt_backup);
34093411 thd->set_n_backup_active_arena (this , &stmt_backup);
3412+ int32 saved_safe_to_display = thd->safe_to_display ();
3413+ thd->set_safe_display (true );
34103414
34113415 if (alloc_query (thd, packet, packet_len))
34123416 {
34133417 thd->restore_backup_statement (this , &stmt_backup);
34143418 thd->restore_active_arena (this , &stmt_backup);
3419+ thd->set_safe_display (saved_safe_to_display);
34153420 DBUG_RETURN (TRUE );
34163421 }
34173422
@@ -3433,6 +3438,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
34333438 thd->restore_backup_statement (this , &stmt_backup);
34343439 thd->restore_active_arena (this , &stmt_backup);
34353440 thd->stmt_arena = old_stmt_arena;
3441+ thd->set_safe_display (saved_safe_to_display);
34363442 DBUG_RETURN (TRUE );
34373443 }
34383444
@@ -3522,6 +3528,7 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
35223528
35233529 cleanup_stmt ();
35243530 thd->restore_backup_statement (this , &stmt_backup);
3531+ thd->set_safe_display (saved_safe_to_display);
35253532 thd->stmt_arena = old_stmt_arena;
35263533
35273534 if (error == 0 )
@@ -3751,6 +3758,8 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
37513758 thd->set_n_backup_statement (this , &stmt_backup);
37523759 thd->set_n_backup_active_arena (this , &stmt_backup);
37533760 thd->stmt_arena = this ;
3761+ int32 saved_safe_to_display = thd->safe_to_display ();
3762+ thd->set_safe_display (true );
37543763
37553764 error= server_runnable->execute_server_code (thd);
37563765
@@ -3759,6 +3768,7 @@ Prepared_statement::execute_server_runnable(Server_runnable *server_runnable)
37593768 thd->restore_active_arena (this , &stmt_backup);
37603769 thd->restore_backup_statement (this , &stmt_backup);
37613770 thd->stmt_arena = save_stmt_arena;
3771+ thd->set_safe_display (saved_safe_to_display);
37623772
37633773 save_change_list.move_elements_to (&thd->change_list );
37643774
@@ -3993,6 +4003,8 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
39934003 */
39944004
39954005 thd->set_n_backup_statement (this , &stmt_backup);
4006+ int32 saved_safe_to_display = thd->safe_to_display ();
4007+ thd->set_safe_display (true );
39964008
39974009 /*
39984010 Change the current database (if needed).
@@ -4107,6 +4119,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
41074119
41084120 thd->set_statement (&stmt_backup);
41094121 thd->stmt_arena = old_stmt_arena;
4122+ thd->set_safe_display (saved_safe_to_display);
41104123
41114124 if (state == Query_arena::STMT_PREPARED)
41124125 state= Query_arena::STMT_EXECUTED;
0 commit comments