summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2022-05-29 19:07:29 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2022-05-29 19:07:29 +0300
commit1ee479fe628603feb35288f475cfc38cdf064d13 (patch)
tree4067d0b6f51c8ae820f90ce7b3e07e6f1743513b
parent9c0bdc767d79da1d59d512bfba814efaa297d4a5 (diff)
downloadmariadb-git-1ee479fe628603feb35288f475cfc38cdf064d13.tar.gz
seems working kinda ehfor_vanislavskiy_speedup
-rw-r--r--extra/frm_parser.cc13
-rw-r--r--sql/sql_show.cc39
2 files changed, 31 insertions, 21 deletions
diff --git a/extra/frm_parser.cc b/extra/frm_parser.cc
index 3554d9e8a97..2d873b10a4e 100644
--- a/extra/frm_parser.cc
+++ b/extra/frm_parser.cc
@@ -34,11 +34,16 @@ void print_ddl(const char *path, const char *table_name)
TABLE table;
char buf[2048];
+ thd->variables.sql_mode &= MODE_IGNORE_BAD_TABLE_OPTIONS;
init_tmp_table_share(thd, &share, "", 0, table_name, path);
open_table_def(thd, &share);
open_table_from_share(thd, &share, &empty_clex_str, 0, READ_ALL, 0, &table,
true);
+ Table_ident name(&table.s->table_name);
+ list.schema_table= NULL;
+// thd->lex->thd= thd;
+// thd->lex->first_select_lex()->add_table_to_list(thd, &name, 0, 0, TL_READ, MDL_SHARED_READ);
list.table= &table;
String query(buf, sizeof(buf), system_charset_info);
@@ -51,10 +56,10 @@ int main(int argc, char **argv)
{
mysql_server_init(-1, NULL, NULL);
wsrep_thr_init();
-#ifdef WITH_WSEP
+//#ifdef WITH_WSEP
if (wsrep_init_server())
unireg_abort(1);
-#endif // WITH_WSEP
+//#endif // WITH_WSEP
MY_INIT(argv[0]);
system_charset_info= &my_charset_utf8mb3_general_ci;
@@ -65,7 +70,7 @@ int main(int argc, char **argv)
my_rnd_init(&sql_rand, (ulong) 123456, (ulong) 123);
frm_plugin_init(argc, argv);
- print_ddl("C:/Users/OMEN/mariadb/bld/mysql-test/var/mysqld.1/data/test/test", "test");
+ print_ddl("/home/nik/mariadb/bld/mysql-test/var/install.db/mysql/help_topic.frm", "test");
return 0;
-} \ No newline at end of file
+}
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index dc8a8c53223..4d626720a5c 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1846,33 +1846,37 @@ static void add_table_options(THD *thd, TABLE *table,
{
sql_mode_t sql_mode= thd->variables.sql_mode;
TABLE_SHARE *share= table->s;
- handlerton *hton;
+ handlerton *hton= NULL;
HA_CREATE_INFO create_info;
bool check_options= (!(sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
(!create_info_arg ||
create_info_arg->used_fields &
HA_CREATE_PRINT_ALL_OPTIONS));
+ if (table->file)
+ {
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (table->part_info)
- hton= table->part_info->default_engine_type;
- else
+ if (table->part_info)
+ hton = table->part_info->default_engine_type;
+ else
#endif
- hton= table->file->ht;
+ hton = table->file->ht;
+ }
bzero((char*) &create_info, sizeof(create_info));
/* Allow update_create_info to update row type, page checksums and options */
create_info.row_type= share->row_type;
create_info.page_checksum= share->page_checksum;
create_info.options= share->db_create_options;
- table->file->update_create_info(&create_info);
+ if (table->file)
+ table->file->update_create_info(&create_info);
/*
IF check_create_info
THEN add ENGINE only if it was used when creating the table
*/
- if (!create_info_arg ||
- (create_info_arg->used_fields & HA_CREATE_USED_ENGINE))
+ if (table->file && (!create_info_arg ||
+ (create_info_arg->used_fields & HA_CREATE_USED_ENGINE)))
{
LEX_CSTRING *engine_name= table->file->engine_name();
@@ -1987,7 +1991,8 @@ static void add_table_options(THD *thd, TABLE *table,
packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
packet->append_ulonglong(table->s->key_block_size);
}
- table->file->append_create_info(packet);
+ if (table->file)
+ table->file->append_create_info(packet);
end_options:
if (share->comment.length)
@@ -2001,7 +2006,7 @@ end_options:
append_unescaped(packet, share->connect_string.str, share->connect_string.length);
}
append_create_options(thd, packet, share->option_list, check_options,
- hton->table_options);
+ hton ? hton->table_options : NULL);
append_directory(thd, packet, &DATA_clex_str, create_info.data_file_name);
append_directory(thd, packet, &INDEX_clex_str, create_info.index_file_name);
}
@@ -2087,17 +2092,17 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
!foreign_db_mode;
bool check_options= !(sql_mode & MODE_IGNORE_BAD_TABLE_OPTIONS) &&
!create_info_arg;
- handlerton *hton;
+// handlerton *hton;
int error= 0;
DBUG_ENTER("show_create_table");
DBUG_PRINT("enter",("table: %s", table->s->table_name.str));
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (table->part_info)
- hton= table->part_info->default_engine_type;
+ if (table->part_info);
+// hton= table->part_info->default_engine_type;
else
#endif
- hton= table->file->ht;
+// hton= table->file->ht;
restore_record(table, s->default_values); // Get empty record
@@ -2291,7 +2296,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
}
append_create_options(thd, packet, field->option_list, check_options,
- hton->field_options);
+ NULL); // hton->field_options);
if (field->check_constraint)
{
@@ -2391,7 +2396,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
packet->append(STRING_WITH_LEN(" */ "));
}
append_create_options(thd, packet, key_info->option_list, check_options,
- hton->index_options);
+ NULL); // hton->index_options);
}
if (table->versioned())
@@ -2419,7 +2424,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
to the CREATE TABLE statement
*/
- if ((for_str= table->file->get_foreign_key_create_info()))
+ if (table->file && (for_str= table->file->get_foreign_key_create_info()))
{
packet->append(for_str, strlen(for_str));
table->file->free_foreign_key_create_info(for_str);