diff --git a/include/mysql/psi/mysql_ps.h b/include/mysql/psi/mysql_ps.h index e68994d949c..f0b2733297a 100644 --- a/include/mysql/psi/mysql_ps.h +++ b/include/mysql/psi/mysql_ps.h @@ -35,8 +35,8 @@ #endif #ifdef HAVE_PSI_PS_INTERFACE - #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ - inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) + #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) \ + inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT) #define MYSQL_DESTROY_PS(PREPARED_STMT) \ @@ -46,7 +46,7 @@ #define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \ inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) #else - #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \ + #define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH) \ NULL #define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \ do {} while (0) @@ -62,15 +62,13 @@ static inline struct PSI_prepared_stmt* inline_mysql_create_prepared_stmt(void *identity, uint stmt_id, PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length, - const char *sqltext, size_t sqltext_length) + const char *stmt_name, size_t stmt_name_length) { if (locker == NULL) return NULL; return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id, locker, - stmt_name, stmt_name_length, - sqltext, sqltext_length); + stmt_name, stmt_name_length); } static inline void diff --git a/include/mysql/psi/psi.h b/include/mysql/psi/psi.h index 3cc392fef67..c6403223724 100644 --- a/include/mysql/psi/psi.h +++ b/include/mysql/psi/psi.h @@ -2350,8 +2350,7 @@ typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); */ typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t) (void *identity, uint stmt_id, PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length, - const char *name, size_t length); + const char *stmt_name, size_t stmt_name_length); /** destroy a prepare statement. diff --git a/include/mysql/psi/psi_abi_v1.h.pp b/include/mysql/psi/psi_abi_v1.h.pp index ec47f0d5253..738ce1ea746 100644 --- a/include/mysql/psi/psi_abi_v1.h.pp +++ b/include/mysql/psi/psi_abi_v1.h.pp @@ -645,8 +645,7 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); typedef PSI_prepared_stmt* (*create_prepared_stmt_v1_t) (void *identity, uint stmt_id, PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length, - const char *name, size_t length); + const char *stmt_name, size_t stmt_name_length); typedef void (*destroy_prepared_stmt_v1_t) (PSI_prepared_stmt *prepared_stmt); typedef void (*reprepare_prepared_stmt_v1_t) diff --git a/mysys/psi_noop.c b/mysys/psi_noop.c index 0b3e1898b1b..132b8395e32 100644 --- a/mysys/psi_noop.c +++ b/mysys/psi_noop.c @@ -732,8 +732,7 @@ static void set_socket_thread_owner_noop(PSI_socket *socket NNN) static PSI_prepared_stmt* create_prepare_stmt_noop(void *identity NNN, uint stmt_id NNN, PSI_statement_locker *locker NNN, - const char *stmt_name NNN, size_t stmt_name_length NNN, - const char *name NNN, size_t length NNN) + const char *stmt_name NNN, size_t stmt_name_length NNN) { return NULL; } diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 8f182b66ce0..216ee5bd680 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2669,8 +2669,7 @@ void mysqld_stmt_prepare(THD *thd, const char *packet, uint packet_length) /* Create PS table entry, set query text after rewrite. */ stmt->m_prepared_stmt= MYSQL_CREATE_PS(stmt, stmt->id, thd->m_statement_psi, - stmt->name.str, stmt->name.length, - NULL, 0); + stmt->name.str, stmt->name.length); if (stmt->prepare(packet, packet_length)) { @@ -2876,8 +2875,7 @@ void mysql_sql_stmt_prepare(THD *thd) /* Create PS table entry, set query text after rewrite. */ stmt->m_prepared_stmt= MYSQL_CREATE_PS(stmt, stmt->id, thd->m_statement_psi, - stmt->name.str, stmt->name.length, - NULL, 0); + stmt->name.str, stmt->name.length); if (stmt->prepare(query.str, (uint) query.length)) { @@ -4901,8 +4899,7 @@ bool Prepared_statement::execute_immediate(const char *query, uint query_len) name= execute_immediate_stmt_name; // for DBUG_PRINT etc m_prepared_stmt= MYSQL_CREATE_PS(this, id, thd->m_statement_psi, - name.str, name.length, - NULL, 0); + name.str, name.length); if (prepare(query, query_len)) DBUG_RETURN(true); diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc index c9d3c678d1a..6a275c9eff1 100644 --- a/storage/perfschema/pfs.cc +++ b/storage/perfschema/pfs.cc @@ -6379,8 +6379,7 @@ void pfs_digest_end_v1(PSI_digest_locker *locker, const sql_digest_storage *dige PSI_prepared_stmt* pfs_create_prepared_stmt_v1(void *identity, uint stmt_id, PSI_statement_locker *locker, - const char *stmt_name, size_t stmt_name_length, - const char *sql_text, size_t sql_text_length) + const char *stmt_name, size_t stmt_name_length) { PSI_statement_locker_state *state= reinterpret_cast (locker); PFS_events_statements *pfs_stmt= reinterpret_cast (state->m_statement); @@ -6390,14 +6389,10 @@ pfs_create_prepared_stmt_v1(void *identity, uint stmt_id, if (unlikely(pfs_thread == NULL)) return NULL; - if (sql_text_length > COL_INFO_SIZE) - sql_text_length= COL_INFO_SIZE; - PFS_prepared_stmt *pfs= create_prepared_stmt(identity, pfs_thread, pfs_program, pfs_stmt, stmt_id, - stmt_name, static_cast(stmt_name_length), - sql_text, static_cast(sql_text_length)); + stmt_name, static_cast(stmt_name_length)); state->m_parent_prepared_stmt= reinterpret_cast(pfs); state->m_in_prepare= true; diff --git a/storage/perfschema/pfs_prepared_stmt.cc b/storage/perfschema/pfs_prepared_stmt.cc index e3440560691..dcb7991633a 100644 --- a/storage/perfschema/pfs_prepared_stmt.cc +++ b/storage/perfschema/pfs_prepared_stmt.cc @@ -78,8 +78,7 @@ PFS_prepared_stmt* create_prepared_stmt(void *identity, PFS_thread *thread, PFS_program *pfs_program, PFS_events_statements *pfs_stmt, uint stmt_id, - const char* stmt_name, uint stmt_name_length, - const char* sqltext, uint sqltext_length) + const char* stmt_name, uint stmt_name_length) { PFS_prepared_stmt *pfs= NULL; pfs_dirty_state dirty_state; @@ -92,11 +91,8 @@ create_prepared_stmt(void *identity, pfs->reset_data(); /* Do the assignments. */ pfs->m_identity= identity; - /* Set query text if available, else it will be set later. */ - if (sqltext_length > 0) - strncpy(pfs->m_sqltext, sqltext, sqltext_length); - pfs->m_sqltext_length= sqltext_length; + pfs->m_sqltext_length= 0; if (stmt_name != NULL) {