summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc59
1 files changed, 33 insertions, 26 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 57562f4d982..5b2fe04f1e2 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -227,7 +227,7 @@ bool mysqld_show_authors(THD *thd)
if (protocol->write())
DBUG_RETURN(TRUE);
}
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -261,7 +261,7 @@ bool mysqld_show_contributors(THD *thd)
if (protocol->write())
DBUG_RETURN(TRUE);
}
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -334,7 +334,7 @@ bool mysqld_show_privileges(THD *thd)
if (protocol->write())
DBUG_RETURN(TRUE);
}
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -422,7 +422,7 @@ bool mysqld_show_column_types(THD *thd)
if (protocol->write())
DBUG_RETURN(TRUE);
}
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -669,7 +669,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (protocol->write())
DBUG_RETURN(TRUE);
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -750,7 +750,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
if (protocol->write())
DBUG_RETURN(TRUE);
- send_eof(thd);
+ my_eof(thd);
DBUG_RETURN(FALSE);
}
@@ -792,7 +792,7 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild)
table->use_all_columns();
if (thd->protocol->send_fields(&field_list, Protocol::SEND_DEFAULTS))
DBUG_VOID_RETURN;
- send_eof(thd);
+ my_eof(thd);
DBUG_VOID_RETURN;
}
@@ -1595,7 +1595,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *buff)
We can't just use table->query, because our SQL_MODE may trigger
a different syntax, like when ANSI_QUOTES is defined.
*/
- table->view->unit.print(buff);
+ table->view->unit.print(buff, QT_ORDINARY);
if (table->with_check != VIEW_CHECK_NONE)
{
@@ -1751,7 +1751,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
if (protocol->write())
break; /* purecov: inspected */
}
- send_eof(thd);
+ my_eof(thd);
DBUG_VOID_RETURN;
}
@@ -3443,7 +3443,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
/*
there was errors during opening tables
*/
- const char *error= thd->main_da.message();
+ const char *error= thd->is_error() ? thd->main_da.message() : "";
if (tables->view)
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
else if (tables->schema_table)
@@ -3651,8 +3651,9 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
rather than in SHOW COLUMNS
*/
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->main_da.sql_errno(), thd->main_da.message());
+ if (thd->is_error())
+ push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+ thd->main_da.sql_errno(), thd->main_da.message());
thd->clear_error();
res= 0;
}
@@ -4079,7 +4080,7 @@ int fill_schema_proc(THD *thd, TABLE_LIST *tables, COND *cond)
proc_tables.table_name= proc_tables.alias= (char*) "proc";
proc_tables.table_name_length= 4;
proc_tables.lock_type= TL_READ;
- full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1);
+ full_access= !check_table_access(thd, SELECT_ACL, &proc_tables, 1, TRUE);
if (!(proc_table= open_proc_table_for_read(thd, &open_tables_state_backup)))
{
DBUG_RETURN(1);
@@ -4467,10 +4468,8 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
Table_triggers_list *triggers= tables->table->triggers;
int event, timing;
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (check_table_access(thd, TRIGGER_ACL, tables, 1))
+ if (check_table_access(thd, TRIGGER_ACL, tables, 1, TRUE))
goto ret;
-#endif
for (event= 0; event < (int)TRG_EVENT_MAX; event++)
{
@@ -4508,9 +4507,7 @@ static int get_schema_triggers_record(THD *thd, TABLE_LIST *tables,
}
}
}
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
ret:
-#endif
DBUG_RETURN(0);
}
@@ -5300,8 +5297,14 @@ get_referential_constraints_record(THD *thd, TABLE_LIST *tables,
f_key_info->referenced_db->length, cs);
table->field[10]->store(f_key_info->referenced_table->str,
f_key_info->referenced_table->length, cs);
- table->field[5]->store(f_key_info->referenced_key_name->str,
- f_key_info->referenced_key_name->length, cs);
+ if (f_key_info->referenced_key_name)
+ {
+ table->field[5]->store(f_key_info->referenced_key_name->str,
+ f_key_info->referenced_key_name->length, cs);
+ table->field[5]->set_notnull();
+ }
+ else
+ table->field[5]->set_null();
table->field[6]->store(STRING_WITH_LEN("NONE"), cs);
table->field[7]->store(f_key_info->update_method->str,
f_key_info->update_method->length, cs);
@@ -5408,8 +5411,9 @@ ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx)
@param
thd thread handler
- @param
- schema_table pointer to 'shema_tables' element
+
+ @param table_list Used to pass I_S table information(fields info, tables
+ parameters etc) and table name.
@retval \# Pointer to created table
@retval NULL Can't create table
@@ -5460,6 +5464,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(NULL);
break;
case MYSQL_TYPE_DECIMAL:
+ case MYSQL_TYPE_NEWDECIMAL:
if (!(item= new Item_decimal((longlong) fields_info->value, false)))
{
DBUG_RETURN(0);
@@ -5809,7 +5814,7 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
{
ST_SCHEMA_TABLE *schema_table= get_schema_table(schema_table_idx);
LEX_STRING db, table;
- DBUG_ENTER("mysql_schema_select");
+ DBUG_ENTER("make_schema_select");
DBUG_PRINT("enter", ("mysql_schema_select: %s", schema_table->table_name));
/*
We have to make non const db_name & table_name
@@ -5904,9 +5909,11 @@ bool get_schema_tables_result(JOIN *join,
{
result= 1;
join->error= 1;
+ tab->read_record.file= table_list->table->file;
table_list->schema_table_state= executed_place;
break;
}
+ tab->read_record.file= table_list->table->file;
table_list->schema_table_state= executed_place;
}
}
@@ -6502,8 +6509,8 @@ ST_FIELD_INFO referential_constraints_fields_info[]=
OPEN_FULL_TABLE},
{"UNIQUE_CONSTRAINT_SCHEMA", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
OPEN_FULL_TABLE},
- {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
- OPEN_FULL_TABLE},
+ {"UNIQUE_CONSTRAINT_NAME", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0,
+ MY_I_S_MAYBE_NULL, 0, OPEN_FULL_TABLE},
{"MATCH_OPTION", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"UPDATE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
{"DELETE_RULE", NAME_CHAR_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
@@ -6784,7 +6791,7 @@ static bool show_create_trigger_impl(THD *thd,
ret_code= p->write();
if (!ret_code)
- send_eof(thd);
+ my_eof(thd);
return ret_code != 0;
}