Commit 25d0f827 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

posmerge fixes

parent d76db8b9
...@@ -1221,11 +1221,11 @@ ERROR 42000: FUNCTION test.x1 does not exist ...@@ -1221,11 +1221,11 @@ ERROR 42000: FUNCTION test.x1 does not exist
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL FUNCTION test.x1 does not exist
show table status; show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL FUNCTION test.x1 does not exist
drop view v1; drop view v1;
drop table t1; drop table t1;
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1; create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
......
...@@ -1793,9 +1793,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference) ...@@ -1793,9 +1793,6 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
!any_privileges)) == !any_privileges)) ==
not_found_field) not_found_field)
{ {
#ifdef EMBEDDED_LIBRARY
thd->net.last_errno= 0;
#endif
SELECT_LEX *last= 0; SELECT_LEX *last= 0;
TABLE_LIST *table_list; TABLE_LIST *table_list;
Item **ref= (Item **) not_found_item; Item **ref= (Item **) not_found_item;
......
...@@ -737,7 +737,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond); ...@@ -737,7 +737,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int get_schema_tables_result(JOIN *join); bool get_schema_tables_result(JOIN *join);
/* sql_prepare.cc */ /* sql_prepare.cc */
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
......
...@@ -1877,7 +1877,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, ...@@ -1877,7 +1877,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
switch(schema_table_idx) { switch(schema_table_idx) {
case SCH_SCHEMATA: case SCH_SCHEMATA:
#if defined(DONT_ALLOW_SHOW_COMMANDS) #if defined(DONT_ALLOW_SHOW_COMMANDS)
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND,
ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); DBUG_RETURN(1);
#else #else
if ((specialflag & SPECIAL_SKIP_SHOW_DB) && if ((specialflag & SPECIAL_SKIP_SHOW_DB) &&
...@@ -1889,30 +1890,30 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, ...@@ -1889,30 +1890,30 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
case SCH_TABLES: case SCH_TABLES:
case SCH_VIEWS: case SCH_VIEWS:
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND,
ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); DBUG_RETURN(1);
#else #else
{ {
char *db= lex->select_lex.db ? lex->select_lex.db : thd->db; char *db= lex->select_lex.db ? lex->select_lex.db : thd->db;
if (!db) if (!db)
{ {
send_error(thd,ER_NO_DB_ERROR); /* purecov: inspected */ my_message(ER_NO_DB_ERROR,
ER(ER_NO_DB_ERROR), MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
remove_escape(db); // Fix escaped '_' remove_escape(db); // Fix escaped '_'
if (check_db_name(db)) if (check_db_name(db))
{ {
net_printf(thd,ER_WRONG_DB_NAME, db); my_error(ER_WRONG_DB_NAME, MYF(0), db);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0)) if (check_access(thd,SELECT_ACL,db,&thd->col_access,0,0))
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
if (!thd->col_access && check_grant_db(thd,db)) if (!thd->col_access && check_grant_db(thd,db))
{ {
net_printf(thd, ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->priv_user, thd->priv_user, thd->priv_host, db);
thd->priv_host,
db);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
lex->select_lex.db= db; lex->select_lex.db= db;
...@@ -1922,7 +1923,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident, ...@@ -1922,7 +1923,8 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
case SCH_COLUMNS: case SCH_COLUMNS:
case SCH_STATISTICS: case SCH_STATISTICS:
#ifdef DONT_ALLOW_SHOW_COMMANDS #ifdef DONT_ALLOW_SHOW_COMMANDS
send_error(thd,ER_NOT_ALLOWED_COMMAND); /* purecov: inspected */ my_message(ER_NOT_ALLOWED_COMMAND,
ER(ER_NOT_ALLOWED_COMMAND), MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); DBUG_RETURN(1);
#else #else
if (table_ident) if (table_ident)
...@@ -5238,8 +5240,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -5238,8 +5240,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->real_name); ST_SCHEMA_TABLE *schema_table= find_schema_table(thd, ptr->real_name);
if (!schema_table) if (!schema_table)
{ {
net_printf(thd, ER_UNKNOWN_TABLE, ptr->real_name, my_error(ER_UNKNOWN_TABLE, MYF(0),
information_schema_name.str); ptr->real_name, information_schema_name.str);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
ptr->schema_table= schema_table; ptr->schema_table= schema_table;
......
...@@ -9770,9 +9770,6 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), ...@@ -9770,9 +9770,6 @@ end_update(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)),
{ {
Item *item= *group->item; Item *item= *group->item;
item->save_org_in_field(group->field); item->save_org_in_field(group->field);
#ifdef EMBEDDED_LIBRARY
join->thd->net.last_errno= 0;
#endif
/* Store in the used key if the field was 0 */ /* Store in the used key if the field was 0 */
if (item->maybe_null) if (item->maybe_null)
group->buff[-1]=item->null_value ? 1 : 0; group->buff[-1]=item->null_value ? 1 : 0;
......
...@@ -1900,7 +1900,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -1900,7 +1900,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
TABLE *old_open_tables= thd->open_tables; TABLE *old_open_tables= thd->open_tables;
TABLE_LIST *show_table_list= (TABLE_LIST*) lsel->table_list.first; TABLE_LIST *show_table_list= (TABLE_LIST*) lsel->table_list.first;
lex->all_selects_list= lsel; lex->all_selects_list= lsel;
int res= open_and_lock_tables(thd, show_table_list); bool res= open_and_lock_tables(thd, show_table_list);
if (schema_table->process_table(thd, show_table_list, if (schema_table->process_table(thd, show_table_list,
table, res, show_table_list->db, table, res, show_table_list->db,
show_table_list->real_name)) show_table_list->real_name))
...@@ -2060,9 +2060,10 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond) ...@@ -2060,9 +2060,10 @@ int fill_schema_shemata(THD *thd, TABLE_LIST *tables, COND *cond)
} }
int get_schema_tables_record(THD *thd, struct st_table_list *tables, static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
TABLE *table, int res, TABLE *table, bool res,
const char *base_name, const char *file_name) const char *base_name,
const char *file_name)
{ {
const char *tmp_buff; const char *tmp_buff;
TIME time; TIME time;
...@@ -2070,18 +2071,21 @@ int get_schema_tables_record(THD *thd, struct st_table_list *tables, ...@@ -2070,18 +2071,21 @@ int get_schema_tables_record(THD *thd, struct st_table_list *tables,
DBUG_ENTER("get_schema_tables_record"); DBUG_ENTER("get_schema_tables_record");
restore_record(table, default_values); restore_record(table, default_values);
if (res > 0)
{
DBUG_RETURN(1);
}
table->field[1]->store(base_name, strlen(base_name), cs); table->field[1]->store(base_name, strlen(base_name), cs);
table->field[2]->store(file_name, strlen(file_name), cs); table->field[2]->store(file_name, strlen(file_name), cs);
if (res < 0 || tables->view) if (res)
{
/*
there was errors during opening tables
*/
const char *error= thd->net.last_error;
table->field[20]->store(error, strlen(error), cs);
thd->clear_error();
}
else if (tables->view)
{ {
table->field[3]->store("VIEW", 4, cs); table->field[3]->store("VIEW", 4, cs);
table->field[20]->store("view", 4, cs); table->field[20]->store("view", 4, cs);
if (res)
thd->clear_error();
} }
else else
{ {
...@@ -2203,9 +2207,10 @@ int get_schema_tables_record(THD *thd, struct st_table_list *tables, ...@@ -2203,9 +2207,10 @@ int get_schema_tables_record(THD *thd, struct st_table_list *tables,
} }
int get_schema_column_record(THD *thd, struct st_table_list *tables, static int get_schema_column_record(THD *thd, struct st_table_list *tables,
TABLE *table, int res, TABLE *table, bool res,
const char *base_name, const char *file_name) const char *base_name,
const char *file_name)
{ {
TIME time; TIME time;
const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS;
...@@ -2538,9 +2543,10 @@ err: ...@@ -2538,9 +2543,10 @@ err:
} }
int get_schema_stat_record(THD *thd, struct st_table_list *tables, static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
TABLE *table, int res, TABLE *table, bool res,
const char *base_name, const char *file_name) const char *base_name,
const char *file_name)
{ {
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_stat_record"); DBUG_ENTER("get_schema_stat_record");
...@@ -2605,13 +2611,14 @@ int get_schema_stat_record(THD *thd, struct st_table_list *tables, ...@@ -2605,13 +2611,14 @@ int get_schema_stat_record(THD *thd, struct st_table_list *tables,
} }
} }
} }
DBUG_RETURN(0); DBUG_RETURN(res);
} }
int get_schema_views_record(THD *thd, struct st_table_list *tables, static int get_schema_views_record(THD *thd, struct st_table_list *tables,
TABLE *table, int res, TABLE *table, bool res,
const char *base_name, const char *file_name) const char *base_name,
const char *file_name)
{ {
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_views_record"); DBUG_ENTER("get_schema_views_record");
...@@ -2631,13 +2638,14 @@ int get_schema_views_record(THD *thd, struct st_table_list *tables, ...@@ -2631,13 +2638,14 @@ int get_schema_views_record(THD *thd, struct st_table_list *tables,
table->file->write_row(table->record[0]); table->file->write_row(table->record[0]);
} }
} }
DBUG_RETURN(0); DBUG_RETURN(res);
} }
int get_schema_constarints_record(THD *thd, struct st_table_list *tables, static int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
TABLE *table, int res, TABLE *table, bool res,
const char *base_name, const char *file_name) const char *base_name,
const char *file_name)
{ {
CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_constarints_record"); DBUG_ENTER("get_schema_constarints_record");
...@@ -2684,12 +2692,13 @@ int get_schema_constarints_record(THD *thd, struct st_table_list *tables, ...@@ -2684,12 +2692,13 @@ int get_schema_constarints_record(THD *thd, struct st_table_list *tables,
table->file->write_row(table->record[0]); table->file->write_row(table->record[0]);
} }
} }
DBUG_RETURN(0); DBUG_RETURN(res);
} }
int get_schema_key_column_usage_record(THD *thd, struct st_table_list *tables, static int get_schema_key_column_usage_record(THD *thd,
TABLE *table, int res, struct st_table_list *tables,
TABLE *table, bool res,
const char *base_name, const char *base_name,
const char *file_name) const char *file_name)
{ {
...@@ -2762,7 +2771,7 @@ int get_schema_key_column_usage_record(THD *thd, struct st_table_list *tables, ...@@ -2762,7 +2771,7 @@ int get_schema_key_column_usage_record(THD *thd, struct st_table_list *tables,
} }
} }
} }
DBUG_RETURN(0); DBUG_RETURN(res);
} }
...@@ -3076,11 +3085,11 @@ int make_schema_select(THD *thd, SELECT_LEX *sel, ...@@ -3076,11 +3085,11 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
join join which use schema tables join join which use schema tables
RETURN RETURN
0 success FALSE success
1 error TRUE error
*/ */
int get_schema_tables_result(JOIN *join) bool get_schema_tables_result(JOIN *join)
{ {
DBUG_ENTER("get_schema_tables_result"); DBUG_ENTER("get_schema_tables_result");
JOIN_TAB *tmp_join_tab= join->join_tab+join->tables; JOIN_TAB *tmp_join_tab= join->join_tab+join->tables;
...@@ -3090,7 +3099,7 @@ int get_schema_tables_result(JOIN *join) ...@@ -3090,7 +3099,7 @@ int get_schema_tables_result(JOIN *join)
if (!tab->table || !tab->table->pos_in_table_list) if (!tab->table || !tab->table->pos_in_table_list)
break; break;
TABLE_LIST *table_list= tab->table->pos_in_table_list; TABLE_LIST *table_list= tab->table->pos_in_table_list;
if (table_list->schema_table && !thd->only_prepare()) if (table_list->schema_table && thd->fill_derived_tables())
{ {
TABLE *old_derived_tables= thd->derived_tables; TABLE *old_derived_tables= thd->derived_tables;
thd->derived_tables= 0; thd->derived_tables= 0;
...@@ -3103,14 +3112,14 @@ int get_schema_tables_result(JOIN *join) ...@@ -3103,14 +3112,14 @@ int get_schema_tables_result(JOIN *join)
{ {
thd->derived_tables= old_derived_tables; thd->derived_tables= old_derived_tables;
thd->lock= sql_lock; thd->lock= sql_lock;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
thd->lock= sql_lock; thd->lock= sql_lock;
thd->lex->sql_command= SQLCOM_SELECT; thd->lex->sql_command= SQLCOM_SELECT;
thd->derived_tables= old_derived_tables; thd->derived_tables= old_derived_tables;
} }
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
......
...@@ -250,7 +250,7 @@ typedef struct st_schema_table ...@@ -250,7 +250,7 @@ typedef struct st_schema_table
/* Handle fileds for old SHOW */ /* Handle fileds for old SHOW */
int (*old_format) (THD *thd, struct st_schema_table *schema_table); int (*old_format) (THD *thd, struct st_schema_table *schema_table);
int (*process_table) (THD *thd, struct st_table_list *tables, int (*process_table) (THD *thd, struct st_table_list *tables,
TABLE *table, int res, const char *base_name, TABLE *table, bool res, const char *base_name,
const char *file_name); const char *file_name);
int idx_field1, idx_field2; int idx_field1, idx_field2;
} ST_SCHEMA_TABLE; } ST_SCHEMA_TABLE;
......
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