Commit ab87fc6c authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove handler::update_table_comment()

The only call of the virtual member function
handler::update_table_comment() was removed in
commit 82d28fad (MySQL 5.5.53)
but the implementation was not removed.

The only non-trivial implementation was for InnoDB. The information
is now returned via handler::get_foreign_key_create_info() and
ha_statistics::delete_length.
parent 17106c98
/* /*
Copyright (c) 2005, 2019, Oracle and/or its affiliates. Copyright (c) 2005, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -2244,25 +2244,6 @@ void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) ...@@ -2244,25 +2244,6 @@ void ha_partition::change_table_ptr(TABLE *table_arg, TABLE_SHARE *share)
} }
} }
/*
Change comments specific to handler
SYNOPSIS
update_table_comment()
comment Original comment
RETURN VALUE
new comment
DESCRIPTION
No comment changes so far
*/
char *ha_partition::update_table_comment(const char *comment)
{
return (char*) comment; /* Nothing to change */
}
/** /**
Handle delete and rename table Handle delete and rename table
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* /*
Copyright (c) 2005, 2012, Oracle and/or its affiliates. Copyright (c) 2005, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab & SkySQL Ab. Copyright (c) 2009, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
...@@ -314,10 +314,6 @@ class ha_partition :public handler ...@@ -314,10 +314,6 @@ class ha_partition :public handler
Meta data routines to CREATE, DROP, RENAME table and often used at Meta data routines to CREATE, DROP, RENAME table and often used at
ALTER TABLE (update_create_info used from ALTER TABLE and SHOW ..). ALTER TABLE (update_create_info used from ALTER TABLE and SHOW ..).
update_table_comment is used in SHOW TABLE commands to provide a
chance for the handler to add any interesting comments to the table
comments not provided by the users comment.
create_partitioning_metadata is called before opening a new handler object create_partitioning_metadata is called before opening a new handler object
with openfrm to call create. It is used to create any local handler with openfrm to call create. It is used to create any local handler
object needed in opening the object in openfrm object needed in opening the object in openfrm
...@@ -330,7 +326,6 @@ class ha_partition :public handler ...@@ -330,7 +326,6 @@ class ha_partition :public handler
virtual int create_partitioning_metadata(const char *name, virtual int create_partitioning_metadata(const char *name,
const char *old_name, int action_flag); const char *old_name, int action_flag);
virtual void update_create_info(HA_CREATE_INFO *create_info); virtual void update_create_info(HA_CREATE_INFO *create_info);
virtual char *update_table_comment(const char *comment);
virtual int change_partitions(HA_CREATE_INFO *create_info, virtual int change_partitions(HA_CREATE_INFO *create_info,
const char *path, const char *path,
ulonglong * const copied, ulonglong * const copied,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#define HANDLER_INCLUDED #define HANDLER_INCLUDED
/* /*
Copyright (c) 2000, 2019, Oracle and/or its affiliates. Copyright (c) 2000, 2019, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB Copyright (c) 2009, 2021, MariaDB
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
...@@ -3363,8 +3363,6 @@ class handler :public Sql_alloc ...@@ -3363,8 +3363,6 @@ class handler :public Sql_alloc
/* end of the list of admin commands */ /* end of the list of admin commands */
virtual int indexes_are_disabled(void) {return 0;} virtual int indexes_are_disabled(void) {return 0;}
virtual char *update_table_comment(const char * comment)
{ return (char*) comment;}
virtual void append_create_info(String *packet) {} virtual void append_create_info(String *packet) {}
/** /**
If index == MAX_KEY then a check for table is made and if index < If index == MAX_KEY then a check for table is made and if index <
......
...@@ -15190,68 +15190,6 @@ ha_innobase::check( ...@@ -15190,68 +15190,6 @@ ha_innobase::check(
DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT); DBUG_RETURN(is_ok ? HA_ADMIN_OK : HA_ADMIN_CORRUPT);
} }
/*************************************************************//**
Adds information about free space in the InnoDB tablespace to a table comment
which is printed out when a user calls SHOW TABLE STATUS. Adds also info on
foreign keys.
@return table comment + InnoDB free space + info on foreign keys */
UNIV_INTERN
char*
ha_innobase::update_table_comment(
/*==============================*/
const char* comment)/*!< in: table comment defined by user */
{
uint length = (uint) strlen(comment);
char* str=0;
size_t flen;
std::string fk_str;
/* We do not know if MySQL can call this function before calling
external_lock(). To be safe, update the thd of the current table
handle. */
if (length > 64000 - 3) {
return((char*) comment); /* string too long */
}
update_thd(ha_thd());
m_prebuilt->trx->op_info = "returning table comment";
#define SSTR( x ) reinterpret_cast< std::ostringstream & >( \
( std::ostringstream() << std::dec << x ) ).str()
fk_str.append("InnoDB free: ");
fk_str.append(SSTR(fsp_get_available_space_in_free_extents(
m_prebuilt->table->space)));
fk_str.append(dict_print_info_on_foreign_keys(
FALSE, m_prebuilt->trx,
m_prebuilt->table));
flen = fk_str.length();
if (length + flen + 3 > 64000) {
flen = 64000 - 3 - length;
}
/* allocate buffer for the full string */
str = (char*) my_malloc(length + flen + 3, MYF(0));
if (str) {
char* pos = str + length;
if (length) {
memcpy(str, comment, length);
*pos++ = ';';
*pos++ = ' ';
}
memcpy(pos, fk_str.c_str(), flen);
pos[flen] = 0;
}
m_prebuilt->trx->op_info = (char*)"";
return(str ? str : (char*) comment);
}
/*******************************************************************//** /*******************************************************************//**
Gets the foreign key create info for a table stored in InnoDB. Gets the foreign key create info for a table stored in InnoDB.
@return own: character string in the form which can be inserted to the @return own: character string in the form which can be inserted to the
......
...@@ -221,7 +221,6 @@ class ha_innobase: public handler ...@@ -221,7 +221,6 @@ class ha_innobase: public handler
int rename_table(const char* from, const char* to); int rename_table(const char* from, const char* to);
inline int defragment_table(const char* name); inline int defragment_table(const char* name);
int check(THD* thd, HA_CHECK_OPT* check_opt); int check(THD* thd, HA_CHECK_OPT* check_opt);
char* update_table_comment(const char* comment);
char* get_foreign_key_create_info(); char* get_foreign_key_create_info();
......
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