mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge
This commit is contained in:
@@ -86,6 +86,47 @@ mysqld_show_dbs(THD *thd,const char *wild)
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** List all open tables in a database
|
||||
***************************************************************************/
|
||||
|
||||
int mysqld_show_open_tables(THD *thd,const char *db,const char *wild)
|
||||
{
|
||||
Item_string *field=new Item_string("",0);
|
||||
List<Item> field_list;
|
||||
char *end,*table_name;
|
||||
List<char> tables;
|
||||
DBUG_ENTER("mysqld_show_open_tables");
|
||||
|
||||
field->name=(char*) thd->alloc(20+(uint) strlen(db)+(wild ? (uint) strlen(wild)+4:0));
|
||||
end=strxmov(field->name,"Open_tables_in_",db,NullS);
|
||||
if (wild && wild[0])
|
||||
strxmov(end," (",wild,")",NullS);
|
||||
field->max_length=NAME_LEN;
|
||||
field_list.push_back(field);
|
||||
field_list.push_back(new Item_empty_string("Comment",80));
|
||||
|
||||
if (send_fields(thd,field_list,1))
|
||||
DBUG_RETURN(1);
|
||||
|
||||
if (list_open_tables(thd,&tables,db,wild))
|
||||
DBUG_RETURN(-1);
|
||||
|
||||
List_iterator<char> it(tables);
|
||||
while ((table_name=it++))
|
||||
{
|
||||
thd->packet.length(0);
|
||||
net_store_data(&thd->packet,table_name);
|
||||
net_store_data(&thd->packet,query_table_status(thd,db,table_name));
|
||||
if (my_net_write(&thd->net,(char*) thd->packet.ptr(),thd->packet.length()))
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
send_eof(&thd->net);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
** List all tables in a database (fast version)
|
||||
** A table is a .frm file in the current databasedir
|
||||
@@ -161,9 +202,9 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
|
||||
}
|
||||
else
|
||||
{
|
||||
// Return only .frm files which isn't temp files.
|
||||
// Return only .frm files which aren't temp files.
|
||||
if (my_strcasecmp(ext=fn_ext(file->name),reg_ext) ||
|
||||
is_prefix(file->name,tmp_file_prefix)) // Mysql temp table
|
||||
is_prefix(file->name,tmp_file_prefix))
|
||||
continue;
|
||||
*ext=0;
|
||||
if (wild && wild[0] && wild_compare(file->name,wild))
|
||||
|
||||
Reference in New Issue
Block a user