Commit 0e6a5786 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove InnoDB wrappers of thd_charset(), thd_query_safe()

innobase_get_charset(), innobase_get_stmt_safe(): Remove.
It is more efficient and readable to invoke thd_charset()
and thd_query_safe() directly, without a non-inlined wrapper function.
parent a2560b00
...@@ -4959,7 +4959,7 @@ dict_create_foreign_constraints( ...@@ -4959,7 +4959,7 @@ dict_create_foreign_constraints(
heap = mem_heap_create(10000); heap = mem_heap_create(10000);
err = dict_create_foreign_constraints_low( err = dict_create_foreign_constraints_low(
trx, heap, innobase_get_charset(trx->mysql_thd), trx, heap, thd_charset(trx->mysql_thd),
str, name, reject_fks); str, name, reject_fks);
mem_heap_free(heap); mem_heap_free(heap);
...@@ -4994,7 +4994,7 @@ dict_foreign_parse_drop_constraints( ...@@ -4994,7 +4994,7 @@ dict_foreign_parse_drop_constraints(
ut_a(trx->mysql_thd); ut_a(trx->mysql_thd);
cs = innobase_get_charset(trx->mysql_thd); cs = thd_charset(trx->mysql_thd);
*n = 0; *n = 0;
......
...@@ -2299,17 +2299,6 @@ innobase_casedn_str( ...@@ -2299,17 +2299,6 @@ innobase_casedn_str(
my_casedn_str(system_charset_info, a); my_casedn_str(system_charset_info, a);
} }
/**********************************************************************//**
Determines the connection character set.
@return connection character set */
CHARSET_INFO*
innobase_get_charset(
/*=================*/
THD* mysql_thd) /*!< in: MySQL thread handle */
{
return(thd_charset(mysql_thd));
}
/** Determines the current SQL statement. /** Determines the current SQL statement.
Thread unsafe, can only be called from the thread owning the THD. Thread unsafe, can only be called from the thread owning the THD.
@param[in] thd MySQL thread handle @param[in] thd MySQL thread handle
...@@ -2329,22 +2318,6 @@ innobase_get_stmt_unsafe( ...@@ -2329,22 +2318,6 @@ innobase_get_stmt_unsafe(
return NULL; return NULL;
} }
/** Determines the current SQL statement.
Thread safe, can be called from any thread as the string is copied
into the provided buffer.
@param[in] thd MySQL thread handle
@param[out] buf Buffer containing SQL statement
@param[in] buflen Length of provided buffer
@return Length of the SQL statement */
size_t
innobase_get_stmt_safe(
THD* thd,
char* buf,
size_t buflen)
{
return thd_query_safe(thd, buf, buflen);
}
/**********************************************************************//** /**********************************************************************//**
Get the current setting of the tdc_size global parameter. We do Get the current setting of the tdc_size global parameter. We do
a dirty read because for one there is no synchronization object and a dirty read because for one there is no synchronization object and
......
...@@ -508,8 +508,6 @@ size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen); ...@@ -508,8 +508,6 @@ size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen);
extern "C" { extern "C" {
struct charset_info_st *thd_charset(MYSQL_THD thd);
/** Check if a user thread is a replication slave thread /** Check if a user thread is a replication slave thread
@param thd user thread @param thd user thread
@retval 0 the user thread is not a replication slave thread @retval 0 the user thread is not a replication slave thread
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -244,13 +244,7 @@ int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, ...@@ -244,13 +244,7 @@ int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
unsigned int buf_length); unsigned int buf_length);
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
/**********************************************************************//** extern "C" struct charset_info_st *thd_charset(THD *thd);
Determines the connection character set.
@return connection character set */
CHARSET_INFO*
innobase_get_charset(
/*=================*/
THD* thd); /*!< in: MySQL thread handle */
/** Determines the current SQL statement. /** Determines the current SQL statement.
Thread unsafe, can only be called from the thread owning the THD. Thread unsafe, can only be called from the thread owning the THD.
...@@ -262,19 +256,6 @@ innobase_get_stmt_unsafe( ...@@ -262,19 +256,6 @@ innobase_get_stmt_unsafe(
THD* thd, THD* thd,
size_t* length); size_t* length);
/** Determines the current SQL statement.
Thread safe, can be called from any thread as the string is copied
into the provided buffer.
@param[in] thd MySQL thread handle
@param[out] buf Buffer containing SQL statement
@param[in] buflen Length of provided buffer
@return Length of the SQL statement */
size_t
innobase_get_stmt_safe(
THD* thd,
char* buf,
size_t buflen);
/******************************************************************//** /******************************************************************//**
This function is used to find the storage length in bytes of the first n This function is used to find the storage length in bytes of the first n
characters for prefix indexes using a multibyte character set. The function characters for prefix indexes using a multibyte character set. The function
......
...@@ -450,7 +450,6 @@ fill_trx_row( ...@@ -450,7 +450,6 @@ fill_trx_row(
which to copy volatile which to copy volatile
strings */ strings */
{ {
size_t stmt_len;
const char* s; const char* s;
ut_ad(lock_mutex_own()); ut_ad(lock_mutex_own());
...@@ -485,16 +484,14 @@ fill_trx_row( ...@@ -485,16 +484,14 @@ fill_trx_row(
row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd); row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1]; char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
stmt_len = innobase_get_stmt_safe(trx->mysql_thd, query, sizeof(query)); if (size_t stmt_len = thd_query_safe(trx->mysql_thd, query,
sizeof query)) {
if (stmt_len > 0) {
row->trx_query = static_cast<const char*>( row->trx_query = static_cast<const char*>(
ha_storage_put_memlim( ha_storage_put_memlim(
cache->storage, query, stmt_len + 1, cache->storage, query, stmt_len + 1,
MAX_ALLOWED_FOR_STORAGE(cache))); MAX_ALLOWED_FOR_STORAGE(cache)));
row->trx_query_cs = innobase_get_charset(trx->mysql_thd); row->trx_query_cs = thd_charset(trx->mysql_thd);
if (row->trx_query == NULL) { if (row->trx_query == NULL) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment