Changed table_list->name -> table_list->alias to find places where we where using alias instead of table_name.
This should fix some issues where --lower-case-table-names doesn't work properly under windows.
This commit is contained in:
parent
76d7ab0ad2
commit
cb8580a2cd
@ -701,6 +701,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
opt_mysql_unix_port= my_strdup(MYSQL_NAMEDPIPE, MYF(0));
|
||||
#endif
|
||||
break;
|
||||
#include <sslopt-case.h>
|
||||
case 'V':
|
||||
usage(1);
|
||||
exit(0);
|
||||
|
@ -470,7 +470,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
|
||||
DBUG_ENTER("lock_table_name");
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->name)
|
||||
key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->real_name)
|
||||
-key)+ 1;
|
||||
|
||||
/* Only insert the table if we haven't insert it already */
|
||||
@ -499,7 +499,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list)
|
||||
my_free((gptr) table,MYF(0));
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (remove_table_from_cache(thd, table_list->db, table_list->name))
|
||||
if (remove_table_from_cache(thd, table_list->db, table_list->real_name))
|
||||
DBUG_RETURN(1); // Table is in use
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -1718,7 +1718,7 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli)
|
||||
TABLE_LIST tables;
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db = thd->db;
|
||||
tables.name = tables.real_name = (char*)table_name;
|
||||
tables.alias = tables.real_name = (char*)table_name;
|
||||
tables.lock_type = TL_WRITE;
|
||||
// the table will be opened in mysql_load
|
||||
if (table_rules_on && !tables_ok(thd, &tables))
|
||||
|
@ -1884,9 +1884,6 @@ int main(int argc, char **argv)
|
||||
charsets_list = list_charsets(MYF(MY_COMPILED_SETS|MY_CONFIG_SETS));
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
if (opt_ssl_key || opt_ssl_cert || opt_ssl_ca || opt_ssl_capath ||
|
||||
opt_ssl_cipher)
|
||||
opt_use_ssl= 1;
|
||||
if (opt_use_ssl)
|
||||
{
|
||||
/* having ssl_acceptor_fd != 0 signals the use of SSL */
|
||||
@ -3969,6 +3966,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
|
||||
net_buffer_length= atoi(argument);
|
||||
break;
|
||||
#endif
|
||||
#include <sslopt-case.h>
|
||||
case 'v':
|
||||
case 'V':
|
||||
print_version();
|
||||
|
@ -913,7 +913,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db,
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db = (char*)db;
|
||||
tables.name = tables.real_name = (char*)table_name;
|
||||
tables.alias= tables.real_name= (char*)table_name;
|
||||
tables.lock_type = TL_WRITE;
|
||||
thd->proc_info = "Opening master dump table";
|
||||
if (!open_ltable(thd, &tables, TL_WRITE))
|
||||
|
@ -156,9 +156,9 @@ my_bool acl_init(bool dont_read_acl_tables)
|
||||
thd->db= my_strdup("mysql",MYF(0));
|
||||
thd->db_length=5; // Safety
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables[0].name=tables[0].real_name=(char*) "host";
|
||||
tables[1].name=tables[1].real_name=(char*) "user";
|
||||
tables[2].name=tables[2].real_name=(char*) "db";
|
||||
tables[0].alias=tables[0].real_name=(char*) "host";
|
||||
tables[1].alias=tables[1].real_name=(char*) "user";
|
||||
tables[2].alias=tables[2].real_name=(char*) "db";
|
||||
tables[0].next=tables+1;
|
||||
tables[1].next=tables+2;
|
||||
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
|
||||
@ -1151,7 +1151,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
|
||||
DBUG_PRINT("enter",("user: %s host: %s",user,host));
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.name=tables.real_name=(char*) "user";
|
||||
tables.alias=tables.real_name=(char*) "user";
|
||||
tables.db=(char*) "mysql";
|
||||
if (!(table=open_ltable(thd,&tables,TL_WRITE)))
|
||||
DBUG_RETURN(1); /* purecov: deadcode */
|
||||
@ -1968,7 +1968,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
check->column.length(),0,0))
|
||||
{
|
||||
my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0),
|
||||
check->column.c_ptr(),table_list->name);
|
||||
check->column.c_ptr(), table_list->alias);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
column_priv |= check->rights | (rights & COL_ACLS);
|
||||
@ -1978,12 +1978,12 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
else if (!(rights & CREATE_ACL) && !revoke_grant)
|
||||
{
|
||||
char buf[FN_REFLEN];
|
||||
sprintf(buf,"%s/%s/%s.frm",mysql_data_home,table_list->db,
|
||||
table_list->name);
|
||||
sprintf(buf,"%s/%s/%s.frm",mysql_data_home, table_list->db,
|
||||
table_list->real_name);
|
||||
fn_format(buf,buf,"","",4+16+32);
|
||||
if (access(buf,F_OK))
|
||||
{
|
||||
my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->name);
|
||||
my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db, table_list->alias);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
}
|
||||
@ -1991,9 +1991,9 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
/* open the mysql.tables_priv and mysql.columns_priv tables */
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables[0].name=tables[0].real_name= (char*) "user";
|
||||
tables[1].name=tables[1].real_name= (char*) "tables_priv";
|
||||
tables[2].name=tables[2].real_name= (char*) "columns_priv";
|
||||
tables[0].alias=tables[0].real_name= (char*) "user";
|
||||
tables[1].alias=tables[1].real_name= (char*) "tables_priv";
|
||||
tables[2].alias=tables[2].real_name= (char*) "columns_priv";
|
||||
tables[0].next=tables+1;
|
||||
/* Don't open column table if we don't need it ! */
|
||||
tables[1].next=((column_priv ||
|
||||
@ -2041,20 +2041,20 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
/* Find/create cached table grant */
|
||||
grant_table= table_hash_search(Str->host.str,NullS,table_list->db,
|
||||
Str->user.str,
|
||||
table_list->name,1);
|
||||
table_list->real_name,1);
|
||||
if (!grant_table)
|
||||
{
|
||||
if (revoke_grant)
|
||||
{
|
||||
my_printf_error(ER_NONEXISTING_TABLE_GRANT,
|
||||
ER(ER_NONEXISTING_TABLE_GRANT),MYF(0),
|
||||
Str->user.str, Str->host.str,table_list->name);
|
||||
Str->user.str, Str->host.str, table_list->alias);
|
||||
result= -1;
|
||||
continue;
|
||||
}
|
||||
grant_table = new GRANT_TABLE (Str->host.str,table_list->db,
|
||||
Str->user.str,
|
||||
table_list->name,
|
||||
table_list->real_name,
|
||||
rights,
|
||||
column_priv);
|
||||
if (!grant_table) // end of memory
|
||||
@ -2101,7 +2101,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
|
||||
if (replace_table_table(thd,grant_table,tables[1].table,*Str,
|
||||
table_list->db,
|
||||
table_list->name,
|
||||
table_list->real_name,
|
||||
rights, column_priv, revoke_grant))
|
||||
{ // Crashend table ??
|
||||
result= -1; /* purecov: deadcode */
|
||||
@ -2111,7 +2111,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list,
|
||||
if ((replace_column_table(grant_table,tables[2].table, *Str,
|
||||
columns,
|
||||
table_list->db,
|
||||
table_list->name,
|
||||
table_list->real_name,
|
||||
rights, revoke_grant)))
|
||||
{
|
||||
result= -1;
|
||||
@ -2153,8 +2153,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
|
||||
|
||||
/* open the mysql.user and mysql.db tables */
|
||||
|
||||
tables[0].name=tables[0].real_name=(char*) "user";
|
||||
tables[1].name=tables[1].real_name=(char*) "db";
|
||||
tables[0].alias=tables[0].real_name=(char*) "user";
|
||||
tables[1].alias=tables[1].real_name=(char*) "db";
|
||||
tables[0].next=tables+1;
|
||||
tables[1].next=0;
|
||||
tables[0].lock_type=tables[1].lock_type=TL_WRITE;
|
||||
@ -2251,8 +2251,8 @@ my_bool grant_init(void)
|
||||
thd->db= my_strdup("mysql",MYF(0));
|
||||
thd->db_length=5; // Safety
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables[0].name=tables[0].real_name= (char*) "tables_priv";
|
||||
tables[1].name=tables[1].real_name= (char*) "columns_priv";
|
||||
tables[0].alias=tables[0].real_name= (char*) "tables_priv";
|
||||
tables[1].alias=tables[1].real_name= (char*) "columns_priv";
|
||||
tables[0].next=tables+1;
|
||||
tables[0].lock_type=tables[1].lock_type=TL_READ;
|
||||
tables[0].db=tables[1].db=thd->db;
|
||||
|
@ -370,7 +370,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
|
||||
bool found=0;
|
||||
for (TABLE_LIST *table=tables ; table ; table=table->next)
|
||||
{
|
||||
if (remove_table_from_cache(thd, table->db, table->name, 1))
|
||||
if (remove_table_from_cache(thd, table->db, table->real_name, 1))
|
||||
found=1;
|
||||
}
|
||||
if (!found)
|
||||
@ -730,7 +730,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
|
||||
DBUG_RETURN(0);
|
||||
|
||||
char* db = thd->db ? thd->db : table_list->db;
|
||||
char* table_name = table_list->name;
|
||||
char* table_name = table_list->real_name;
|
||||
char key[MAX_DBKEY_LENGTH];
|
||||
uint key_length;
|
||||
key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1;
|
||||
@ -1287,7 +1287,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
|
||||
|
||||
TABLE_LIST table_list;
|
||||
table_list.db=(char*) db;
|
||||
table_list.name=(char*) name;
|
||||
table_list.real_name=(char*) name;
|
||||
table_list.next=0;
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
@ -1359,7 +1359,7 @@ int open_tables(THD *thd,TABLE_LIST *start)
|
||||
!(tables->table=open_table(thd,
|
||||
tables->db,
|
||||
tables->real_name,
|
||||
tables->name, &refresh)))
|
||||
tables->alias, &refresh)))
|
||||
{
|
||||
if (refresh) // Refresh in progress
|
||||
{
|
||||
@ -1415,7 +1415,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
|
||||
thd->proc_info="Opening table";
|
||||
while (!(table=open_table(thd,table_list->db,
|
||||
table_list->real_name,table_list->name,
|
||||
table_list->real_name,table_list->alias,
|
||||
&refresh)) && refresh) ;
|
||||
if (table)
|
||||
{
|
||||
@ -1439,7 +1439,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type)
|
||||
{
|
||||
my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,
|
||||
ER(ER_TABLE_NOT_LOCKED_FOR_WRITE),
|
||||
MYF(0),table_list->name);
|
||||
MYF(0),table_list->alias);
|
||||
table=0;
|
||||
}
|
||||
else if ((error=table->file->start_stmt(thd)))
|
||||
@ -1635,7 +1635,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables)
|
||||
bool found_table=0;
|
||||
for (; tables ; tables=tables->next)
|
||||
{
|
||||
if (!strcmp(tables->name,table_name) &&
|
||||
if (!strcmp(tables->alias,table_name) &&
|
||||
(!db || !strcmp(db,tables->db)))
|
||||
{
|
||||
found_table=1;
|
||||
@ -1900,7 +1900,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name,
|
||||
if (grant_option && !thd->master_access &&
|
||||
check_grant_all_columns(thd,SELECT_ACL,table) )
|
||||
DBUG_RETURN(-1);
|
||||
if (!table_name || (!strcmp(table_name,tables->name) &&
|
||||
if (!table_name || (!strcmp(table_name,tables->alias) &&
|
||||
(!db_name || !strcmp(tables->db,db_name))))
|
||||
{
|
||||
Field **ptr=table->field,*field;
|
||||
|
@ -963,12 +963,12 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
||||
|
||||
Query_cache_table *table = block_table->parent;
|
||||
table_list.db = table->db();
|
||||
table_list.name = table_list.real_name = table->table();
|
||||
table_list.alias= table_list.real_name= table->table();
|
||||
if (check_table_access(thd,SELECT_ACL,&table_list,1))
|
||||
{
|
||||
DBUG_PRINT("qcache",
|
||||
("probably no SELECT access to %s.%s => return to normal processing",
|
||||
table_list.db, table_list.name));
|
||||
table_list.db, table_list.alias));
|
||||
refused++; // This is actually a hit
|
||||
STRUCT_UNLOCK(&structure_guard_mutex);
|
||||
thd->safe_to_cache_query=0; // Don't try to cache this
|
||||
@ -978,7 +978,7 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
|
||||
if (table_list.grant.want_privilege)
|
||||
{
|
||||
DBUG_PRINT("qcache", ("Need to check column privileges for %s.%s",
|
||||
table_list.db, table_list.name));
|
||||
table_list.db, table_list.alias));
|
||||
BLOCK_UNLOCK_RD(query_block);
|
||||
thd->safe_to_cache_query=0; // Don't try to cache this
|
||||
goto err_unlock; // Parse query
|
||||
|
@ -57,7 +57,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
|
||||
// there can be only one table in *tables
|
||||
if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
|
||||
{
|
||||
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->name);
|
||||
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias);
|
||||
mysql_ha_close(thd, tables,1);
|
||||
return -1;
|
||||
}
|
||||
@ -68,7 +68,7 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
|
||||
|
||||
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
|
||||
{
|
||||
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->name);
|
||||
TABLE **ptr=find_table_ptr_by_name(thd, tables->db, tables->alias);
|
||||
|
||||
if (*ptr)
|
||||
{
|
||||
@ -79,7 +79,7 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool dont_send_ok)
|
||||
else
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
|
||||
tables->name,"HANDLER");
|
||||
tables->alias, "HANDLER");
|
||||
return -1;
|
||||
}
|
||||
if (!dont_send_ok)
|
||||
@ -97,11 +97,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
ha_rows select_limit,ha_rows offset_limit)
|
||||
{
|
||||
int err, keyno=-1;
|
||||
TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->name);
|
||||
TABLE *table=*find_table_ptr_by_name(thd, tables->db, tables->alias);
|
||||
if (!table)
|
||||
{
|
||||
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
|
||||
tables->name,"HANDLER");
|
||||
tables->alias,"HANDLER");
|
||||
return -1;
|
||||
}
|
||||
tables->table=table;
|
||||
@ -114,7 +114,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
if ((keyno=find_type(keyname, &table->keynames, 1+2)-1)<0)
|
||||
{
|
||||
my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0),
|
||||
keyname,tables->name);
|
||||
keyname,tables->alias);
|
||||
return -1;
|
||||
}
|
||||
table->file->index_init(keyno);
|
||||
@ -126,7 +126,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
uint num_rows;
|
||||
it++;
|
||||
|
||||
insert_fields(thd,tables,tables->db,tables->name,&it);
|
||||
insert_fields(thd,tables,tables->db,tables->alias,&it);
|
||||
|
||||
table->file->init_table_handle_for_HANDLER(); // Only InnoDB requires it
|
||||
|
||||
@ -258,7 +258,7 @@ err0:
|
||||
here for alias, not real table name
|
||||
*/
|
||||
static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
|
||||
const char *table_name)
|
||||
const char *alias)
|
||||
{
|
||||
int dblen;
|
||||
TABLE **ptr;
|
||||
@ -271,7 +271,7 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
|
||||
for (TABLE *table=*ptr; table ; table=*ptr)
|
||||
{
|
||||
if (!memcmp(table->table_cache_key, db, dblen) &&
|
||||
!my_strcasecmp(table->table_name,table_name))
|
||||
!my_strcasecmp(table->table_name,alias))
|
||||
break;
|
||||
ptr=&(table->next);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ check_insert_fields(THD *thd,TABLE *table,List<Item> &fields,
|
||||
TABLE_LIST table_list;
|
||||
bzero((char*) &table_list,sizeof(table_list));
|
||||
table_list.db= table->table_cache_key;
|
||||
table_list.name=table->table_name;
|
||||
table_list.real_name= table_list.alias= table->table_name;
|
||||
table_list.table=table;
|
||||
table_list.grant=table->grant;
|
||||
|
||||
@ -655,7 +655,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
|
||||
}
|
||||
tmp->table_list= *table_list; // Needed to open table
|
||||
tmp->table_list.db= tmp->thd.db;
|
||||
tmp->table_list.name= tmp->table_list.real_name=tmp->thd.query;
|
||||
tmp->table_list.alias= tmp->table_list.real_name=tmp->thd.query;
|
||||
tmp->lock();
|
||||
pthread_mutex_lock(&tmp->mutex);
|
||||
if ((error=pthread_create(&tmp->thd.real_id,&connection_attrib,
|
||||
|
@ -804,7 +804,7 @@ int mysql_table_dump(THD* thd, char* db, char* tbl_name, int fd)
|
||||
if (!(table_list = (TABLE_LIST*) thd->calloc(sizeof(TABLE_LIST))))
|
||||
DBUG_RETURN(1); // out of memory
|
||||
table_list->db = db;
|
||||
table_list->real_name = table_list->name = tbl_name;
|
||||
table_list->real_name = table_list->alias = tbl_name;
|
||||
table_list->lock_type = TL_READ_NO_INSERT;
|
||||
table_list->next = 0;
|
||||
remove_escape(table_list->real_name);
|
||||
@ -1022,7 +1022,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
break;
|
||||
}
|
||||
thd->free_list=0;
|
||||
table_list.name=table_list.real_name=thd->strdup(packet);
|
||||
table_list.alias= table_list.real_name= thd->strdup(packet);
|
||||
packet=strend(packet)+1;
|
||||
// command not cachable => no gap for data base name
|
||||
if (!(thd->query=fields=thd->memdup(packet,thd->query_length+1)))
|
||||
@ -1485,9 +1485,9 @@ mysql_execute_command(void)
|
||||
if (error)
|
||||
goto error;
|
||||
}
|
||||
if (strlen(tables->name) > NAME_LEN)
|
||||
if (strlen(tables->real_name) > NAME_LEN)
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->name);
|
||||
net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->real_name);
|
||||
break;
|
||||
}
|
||||
LOCK_ACTIVE_MI;
|
||||
@ -1521,9 +1521,9 @@ mysql_execute_command(void)
|
||||
if (error)
|
||||
goto error;
|
||||
}
|
||||
if (strlen(tables->name) > NAME_LEN)
|
||||
if (strlen(tables->real_name) > NAME_LEN)
|
||||
{
|
||||
net_printf(&thd->net,ER_WRONG_TABLE_NAME,tables->name);
|
||||
net_printf(&thd->net, ER_WRONG_TABLE_NAME, tables->alias);
|
||||
res=0;
|
||||
break;
|
||||
}
|
||||
@ -1532,9 +1532,9 @@ mysql_execute_command(void)
|
||||
#else
|
||||
/* Fix names if symlinked tables */
|
||||
if (append_file_to_dir(thd, &lex->create_info.data_file_name,
|
||||
tables->name) ||
|
||||
tables->real_name) ||
|
||||
append_file_to_dir(thd,&lex->create_info.index_file_name,
|
||||
tables->name))
|
||||
tables->real_name))
|
||||
{
|
||||
res=-1;
|
||||
break;
|
||||
@ -2135,7 +2135,7 @@ mysql_execute_command(void)
|
||||
goto error; /* purecov: inspected */
|
||||
}
|
||||
remove_escape(db); // Fix escaped '_'
|
||||
remove_escape(tables->name);
|
||||
remove_escape(tables->real_name);
|
||||
if (check_access(thd,SELECT_ACL | EXTRA_ACL,db,&thd->col_access))
|
||||
goto error; /* purecov: inspected */
|
||||
tables->grant.privilege=thd->col_access;
|
||||
@ -2160,7 +2160,7 @@ mysql_execute_command(void)
|
||||
goto error; /* purecov: inspected */
|
||||
}
|
||||
remove_escape(db); // Fix escaped '_'
|
||||
remove_escape(tables->name);
|
||||
remove_escape(tables->real_name);
|
||||
if (!tables->db)
|
||||
tables->db=thd->db;
|
||||
if (check_access(thd,SELECT_ACL,db,&thd->col_access))
|
||||
@ -3218,7 +3218,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
|
||||
ptr->db_length= 0;
|
||||
}
|
||||
|
||||
ptr->name=alias_str;
|
||||
ptr->alias= alias_str;
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
casedn_str(ptr->db);
|
||||
@ -3242,7 +3242,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
|
||||
tables ;
|
||||
tables=tables->next)
|
||||
{
|
||||
if (!strcmp(alias_str,tables->name) && !strcmp(ptr->db, tables->db))
|
||||
if (!strcmp(alias_str,tables->alias) && !strcmp(ptr->db, tables->db))
|
||||
{
|
||||
net_printf(&thd->net,ER_NONUNIQ_TABLE,alias_str); /* purecov: tested */
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
@ -3291,7 +3291,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
|
||||
for (cursor= *result; cursor; cursor=cursor->next)
|
||||
if (!strcmp(cursor->db,aux->db) &&
|
||||
!strcmp(cursor->real_name,aux->real_name) &&
|
||||
!strcmp(cursor->name, aux->name))
|
||||
!strcmp(cursor->alias, aux->alias))
|
||||
break;
|
||||
if (!cursor)
|
||||
{
|
||||
|
@ -307,7 +307,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
||||
packet->length(0);
|
||||
net_store_data(packet,convert, file_name);
|
||||
table_list.db=(char*) db;
|
||||
table_list.real_name=table_list.name=file_name;
|
||||
table_list.real_name= table_list.alias= file_name;
|
||||
if (!(table = open_ltable(thd, &table_list, TL_READ)))
|
||||
{
|
||||
for (uint i=0 ; i < field_list.elements ; i++)
|
||||
|
@ -905,7 +905,7 @@ static int send_check_errmsg(THD* thd, TABLE_LIST* table,
|
||||
|
||||
String* packet = &thd->packet;
|
||||
packet->length(0);
|
||||
net_store_data(packet, table->name);
|
||||
net_store_data(packet, table->alias);
|
||||
net_store_data(packet, (char*)operator_name);
|
||||
net_store_data(packet, "error");
|
||||
net_store_data(packet, errmsg);
|
||||
@ -993,7 +993,7 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
|
||||
char from[FN_REFLEN],tmp[FN_REFLEN];
|
||||
char* db = thd->db ? thd->db : table->db;
|
||||
|
||||
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->name);
|
||||
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->real_name);
|
||||
fn_format(from, from, "", MI_NAME_DEXT, 4);
|
||||
sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);
|
||||
|
||||
@ -1077,7 +1077,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
char table_name[NAME_LEN*2+2];
|
||||
char* db = (table->db) ? table->db : thd->db;
|
||||
bool fatal_error=0;
|
||||
strxmov(table_name,db ? db : "",".",table->name,NullS);
|
||||
strxmov(table_name,db ? db : "",".",table->real_name,NullS);
|
||||
|
||||
thd->open_options|= extra_open_options;
|
||||
table->table = open_ltable(thd, table, lock_type);
|
||||
@ -1985,7 +1985,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
|
||||
MYF(MY_FAE | MY_ZEROFILL));
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.table = from;
|
||||
tables.name = tables.real_name= from->real_name;
|
||||
tables.alias = tables.real_name= from->real_name;
|
||||
tables.db = from->table_cache_key;
|
||||
error=1;
|
||||
|
||||
|
@ -141,7 +141,7 @@ void udf_init()
|
||||
new_thd->db_length=5;
|
||||
|
||||
bzero((gptr) &tables,sizeof(tables));
|
||||
tables.name = tables.real_name = (char*) "func";
|
||||
tables.alias= tables.real_name = (char*) "func";
|
||||
tables.lock_type = TL_READ;
|
||||
tables.db=new_thd->db;
|
||||
|
||||
@ -415,7 +415,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db= (char*) "mysql";
|
||||
tables.real_name=tables.name= (char*) "func";
|
||||
tables.real_name= tables.alias= (char*) "func";
|
||||
/* Allow creation of functions even if we can't open func table */
|
||||
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
|
||||
goto err;
|
||||
@ -474,7 +474,7 @@ int mysql_drop_function(THD *thd,const char *udf_name)
|
||||
|
||||
bzero((char*) &tables,sizeof(tables));
|
||||
tables.db=(char*) "mysql";
|
||||
tables.real_name=tables.name=(char*) "func";
|
||||
tables.real_name= tables.alias= (char*) "func";
|
||||
if (!(table = open_ltable(thd,&tables,TL_WRITE)))
|
||||
goto err;
|
||||
if (!table->file->index_read_idx(table->record[0],0,(byte*) udf_name,
|
||||
|
@ -130,7 +130,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
|
||||
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
|
||||
bzero((char*) &result_table_list,sizeof(result_table_list));
|
||||
result_table_list.db= (char*) "";
|
||||
result_table_list.real_name=result_table_list.name=(char*) "union";
|
||||
result_table_list.real_name=result_table_list.alias= (char*) "union";
|
||||
result_table_list.table=table;
|
||||
|
||||
if (!(union_result=new select_union(table)))
|
||||
|
@ -2033,8 +2033,8 @@ join_table_list:
|
||||
| join_table_list INNER_SYM JOIN_SYM join_table
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
sel->db1=$1->db; sel->table1=$1->name;
|
||||
sel->db2=$4->db; sel->table2=$4->name;
|
||||
sel->db1=$1->db; sel->table1=$1->alias;
|
||||
sel->db2=$4->db; sel->table2=$4->alias;
|
||||
}
|
||||
USING '(' using_list ')'
|
||||
{ add_join_on($4,$8); $$=$4; }
|
||||
@ -2043,8 +2043,8 @@ join_table_list:
|
||||
| join_table_list LEFT opt_outer JOIN_SYM join_table
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
sel->db1=$1->db; sel->table1=$1->name;
|
||||
sel->db2=$5->db; sel->table2=$5->name;
|
||||
sel->db1=$1->db; sel->table1=$1->alias;
|
||||
sel->db2=$5->db; sel->table2=$5->alias;
|
||||
}
|
||||
USING '(' using_list ')'
|
||||
{ add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
|
||||
@ -2055,8 +2055,8 @@ join_table_list:
|
||||
| join_table_list RIGHT opt_outer JOIN_SYM join_table
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
sel->db1=$1->db; sel->table1=$1->name;
|
||||
sel->db2=$5->db; sel->table2=$5->name;
|
||||
sel->db1=$1->db; sel->table1=$1->alias;
|
||||
sel->db2=$5->db; sel->table2=$5->alias;
|
||||
}
|
||||
USING '(' using_list ')'
|
||||
{ add_join_on($1,$9); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$1; }
|
||||
|
18
sql/table.h
18
sql/table.h
@ -138,20 +138,20 @@ struct st_table {
|
||||
typedef struct st_table_list
|
||||
{
|
||||
struct st_table_list *next;
|
||||
char *db,*name,*real_name;
|
||||
uint32 db_length, real_name_length;
|
||||
Item *on_expr; /* Used with outer join */
|
||||
struct st_table_list *natural_join; /* natural join on this table*/
|
||||
char *db, *alias, *real_name;
|
||||
Item *on_expr; /* Used with outer join */
|
||||
struct st_table_list *natural_join; /* natural join on this table*/
|
||||
/* ... join ... USE INDEX ... IGNORE INDEX */
|
||||
List<String> *use_index,*ignore_index;
|
||||
TABLE *table;
|
||||
GRANT_INFO grant;
|
||||
thr_lock_type lock_type;
|
||||
uint outer_join; /* Which join type */
|
||||
bool straight; /* optimize with prev table */
|
||||
bool updating; /* for replicate-do/ignore table */
|
||||
bool shared; /* Used twice in union */
|
||||
bool do_redirect; /* To get the struct in UNION's */
|
||||
uint outer_join; /* Which join type */
|
||||
uint32 db_length, real_name_length;
|
||||
bool straight; /* optimize with prev table */
|
||||
bool updating; /* for replicate-do/ignore table */
|
||||
bool shared; /* Used twice in union */
|
||||
bool do_redirect; /* To get the struct in UNION's */
|
||||
} TABLE_LIST;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user