mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge with 5.2
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* Copyright 2000, 2010 Oracle and/or its affiliates. All rights reserved.
|
||||
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
|
||||
2009-2011 Monty Program Ab
|
||||
|
||||
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
|
||||
@@ -565,12 +566,6 @@ find_files(THD *thd, List<LEX_STRING> *files, const char *db,
|
||||
else if (wild_compare(uname, wild, 0))
|
||||
continue;
|
||||
}
|
||||
if (!(file_name=
|
||||
thd->make_lex_string(file_name, uname, file_name_len, TRUE)))
|
||||
{
|
||||
my_dirend(dirp);
|
||||
DBUG_RETURN(FIND_FILES_OOM);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -755,7 +750,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
||||
table_list->table_name));
|
||||
|
||||
/* We want to preserve the tree for views. */
|
||||
thd->lex->view_prepare_mode= TRUE;
|
||||
thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
|
||||
|
||||
{
|
||||
Show_create_error_handler view_error_suppressor(thd, table_list);
|
||||
@@ -3008,7 +3003,10 @@ bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
|
||||
else if (item->type() == Item::REF_ITEM)
|
||||
return uses_only_table_name_fields(item->real_item(), table);
|
||||
|
||||
if (item->type() == Item::SUBSELECT_ITEM && !item->const_item())
|
||||
if ((item->type() == Item::SUBSELECT_ITEM ||
|
||||
(item->get_cached_item() &&
|
||||
item->get_cached_item()->type() == Item::SUBSELECT_ITEM))
|
||||
&& !item->const_item())
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@@ -3714,7 +3712,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
uint derived_tables= lex->derived_tables;
|
||||
int error= 1;
|
||||
Open_tables_state open_tables_state_backup;
|
||||
bool save_view_prepare_mode= lex->view_prepare_mode;
|
||||
uint8 save_context_analysis_only= lex->context_analysis_only;
|
||||
Query_tables_list query_tables_list_backup;
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
Security_context *sctx= thd->security_ctx;
|
||||
@@ -3722,7 +3720,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
uint table_open_method;
|
||||
DBUG_ENTER("get_all_tables");
|
||||
|
||||
lex->view_prepare_mode= TRUE;
|
||||
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
|
||||
|
||||
/*
|
||||
@@ -3854,8 +3851,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
if (!(table_open_method & ~OPEN_FRM_ONLY) &&
|
||||
!with_i_schema)
|
||||
{
|
||||
if (!fill_schema_table_from_frm(thd, table, schema_table, db_name,
|
||||
table_name, schema_table_idx))
|
||||
my_bool res;
|
||||
lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
|
||||
res= fill_schema_table_from_frm(thd, table, schema_table,
|
||||
db_name,
|
||||
table_name, schema_table_idx);
|
||||
lex->context_analysis_only= save_context_analysis_only;
|
||||
if (!res)
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3939,7 +3941,7 @@ err:
|
||||
lex->restore_backup_query_tables_list(&query_tables_list_backup);
|
||||
lex->derived_tables= derived_tables;
|
||||
lex->all_selects_list= old_all_select_lex;
|
||||
lex->view_prepare_mode= save_view_prepare_mode;
|
||||
lex->context_analysis_only= save_context_analysis_only;
|
||||
lex->sql_command= save_sql_command;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@@ -4035,28 +4037,28 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
||||
{
|
||||
const char *tmp_buff;
|
||||
MYSQL_TIME time;
|
||||
int info_error= 0;
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
DBUG_ENTER("get_schema_tables_record");
|
||||
|
||||
restore_record(table, s->default_values);
|
||||
table->field[1]->store(db_name->str, db_name->length, cs);
|
||||
table->field[2]->store(table_name->str, table_name->length, cs);
|
||||
|
||||
if (res)
|
||||
{
|
||||
/*
|
||||
there was errors during opening tables
|
||||
*/
|
||||
const char *error= thd->is_error() ? thd->main_da.message() : "";
|
||||
/* There was a table open error, so set the table type and return */
|
||||
if (tables->view)
|
||||
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
|
||||
else if (tables->schema_table)
|
||||
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
|
||||
else
|
||||
table->field[3]->store(STRING_WITH_LEN("BASE TABLE"), cs);
|
||||
table->field[20]->store(error, strlen(error), cs);
|
||||
thd->clear_error();
|
||||
|
||||
goto err;
|
||||
}
|
||||
else if (tables->view)
|
||||
|
||||
if (tables->view)
|
||||
{
|
||||
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
|
||||
table->field[20]->store(STRING_WITH_LEN("VIEW"), cs);
|
||||
@@ -4157,9 +4159,14 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
||||
if (share->comment.str)
|
||||
table->field[20]->store(share->comment.str, share->comment.length, cs);
|
||||
|
||||
if(file)
|
||||
if (file)
|
||||
{
|
||||
file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO);
|
||||
/* If info() fails, then there's nothing else to do */
|
||||
if ((info_error= file->info(HA_STATUS_VARIABLE |
|
||||
HA_STATUS_TIME |
|
||||
HA_STATUS_AUTO)) != 0)
|
||||
goto err;
|
||||
|
||||
enum row_type row_type = file->get_row_type();
|
||||
switch (row_type) {
|
||||
case ROW_TYPE_NOT_USED:
|
||||
@@ -4237,6 +4244,26 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err:
|
||||
if (res || info_error)
|
||||
{
|
||||
/*
|
||||
If an error was encountered, push a warning, set the TABLE COMMENT
|
||||
column with the error text, and clear the error so that the operation
|
||||
can continue.
|
||||
*/
|
||||
const char *error= thd->is_error() ? thd->main_da.message() : "";
|
||||
table->field[20]->store(error, strlen(error), cs);
|
||||
|
||||
if (thd->is_error())
|
||||
{
|
||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
thd->main_da.sql_errno(), thd->main_da.message());
|
||||
thd->clear_error();
|
||||
}
|
||||
}
|
||||
|
||||
DBUG_RETURN(schema_table_store_record(thd, table));
|
||||
}
|
||||
|
||||
@@ -5035,9 +5062,6 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
|
||||
TABLE *show_table= tables->table;
|
||||
KEY *key_info=show_table->key_info;
|
||||
uint primary_key= show_table->s->primary_key;
|
||||
show_table->file->info(HA_STATUS_VARIABLE |
|
||||
HA_STATUS_NO_LOCK |
|
||||
HA_STATUS_TIME);
|
||||
for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
|
||||
{
|
||||
if (i != primary_key && !(key_info->flags & HA_NOSAME))
|
||||
@@ -5218,9 +5242,6 @@ static int get_schema_key_column_usage_record(THD *thd,
|
||||
TABLE *show_table= tables->table;
|
||||
KEY *key_info=show_table->key_info;
|
||||
uint primary_key= show_table->s->primary_key;
|
||||
show_table->file->info(HA_STATUS_VARIABLE |
|
||||
HA_STATUS_NO_LOCK |
|
||||
HA_STATUS_TIME);
|
||||
for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
|
||||
{
|
||||
if (i != primary_key && !(key_info->flags & HA_NOSAME))
|
||||
@@ -5948,9 +5969,6 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables,
|
||||
{
|
||||
List<FOREIGN_KEY_INFO> f_key_list;
|
||||
TABLE *show_table= tables->table;
|
||||
show_table->file->info(HA_STATUS_VARIABLE |
|
||||
HA_STATUS_NO_LOCK |
|
||||
HA_STATUS_TIME);
|
||||
|
||||
show_table->file->get_foreign_key_list(thd, &f_key_list);
|
||||
FOREIGN_KEY_INFO *f_key_info;
|
||||
|
Reference in New Issue
Block a user