Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-03-21 10:53:42+04:00, gluh@stripped +13 -0
WL3732 Information schema optimization
mysql-test/r/ndb_alter_table.result@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +4
-4
result fix
mysql-test/r/ndb_temporary.result@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +1 -1
result fix
sql/ha_ndbcluster.cc@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +37 -30
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/ha_ndbcluster.h@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +1 -1
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/ha_ndbcluster_binlog.cc@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +4 -4
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/handler.cc@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +2 -2
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/handler.h@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +2 -2
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/sql_base.cc@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +10 -4
WL3732 Information schema optimization
sql/sql_show.cc@stripped, 2007-03-21 10:53:39+04:00, gluh@stripped +1271 -746
WL3732 Information schema optimization
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/sql_show.h@stripped, 2007-03-21 10:53:40+04:00, gluh@stripped +1 -1
char *db_name, *table_name are replaced with LEX_STRING to avoid strlen().
sql/table.cc@stripped, 2007-03-21 10:53:40+04:00, gluh@stripped +16 -3
WL3732 Information schema optimization
sql/table.h@stripped, 2007-03-21 10:53:40+04:00, gluh@stripped +16 -3
WL3732 Information schema optimization
sql/unireg.h@stripped, 2007-03-21 10:53:40+04:00, gluh@stripped +2 -0
WL3732 Information schema optimization
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gluh
# Host: eagle.(none)
# Root: /home/gluh/MySQL/Clear/5.1
--- 1.295/sql/handler.cc 2007-02-05 15:29:22 +04:00
+++ 1.296/sql/handler.cc 2007-03-21 10:53:39 +04:00
@@ -2831,7 +2831,7 @@ struct st_find_files_args
const char *path;
const char *wild;
bool dir;
- List<char> *files;
+ List<LEX_STRING> *files;
};
static my_bool find_files_handlerton(THD *thd, st_plugin_int *plugin,
@@ -2851,7 +2851,7 @@ static my_bool find_files_handlerton(THD
int
ha_find_files(THD *thd,const char *db,const char *path,
- const char *wild, bool dir, List<char> *files)
+ const char *wild, bool dir, List<LEX_STRING> *files)
{
int error= 0;
DBUG_ENTER("ha_find_files");
--- 1.252/sql/handler.h 2006-12-31 04:06:34 +04:00
+++ 1.253/sql/handler.h 2007-03-21 10:53:39 +04:00
@@ -679,7 +679,7 @@ struct handlerton
int (*find_files)(handlerton *hton, THD *thd,
const char *db,
const char *path,
- const char *wild, bool dir, List<char> *files);
+ const char *wild, bool dir, List<LEX_STRING> *files);
int (*table_exists_in_engine)(handlerton *hton, THD* thd, const char *db,
const char *name);
uint32 license; /* Flag for Engine License */
@@ -1682,7 +1682,7 @@ int ha_create_table_from_engine(THD* thd
int ha_discover(THD* thd, const char* dbname, const char* name,
const void** frmblob, uint* frmlen);
int ha_find_files(THD *thd,const char *db,const char *path,
- const char *wild, bool dir,List<char>* files);
+ const char *wild, bool dir, List<LEX_STRING>* files);
int ha_table_exists_in_engine(THD* thd, const char* db, const char* name);
/* key cache */
--- 1.374/sql/sql_base.cc 2007-02-02 10:19:32 +04:00
+++ 1.375/sql/sql_base.cc 2007-03-21 10:53:39 +04:00
@@ -2174,11 +2174,10 @@ static bool reopen_table(TABLE *table)
sql_print_error("Table %s had a open data handler in reopen_table",
table->alias);
#endif
+ bzero((char*) &table_list, sizeof(TABLE_LIST));
table_list.db= table->s->db.str;
table_list.table_name= table->s->table_name.str;
table_list.table= table;
- table_list.belong_to_view= 0;
- table_list.next_local= 0;
if (wait_for_locked_table_names(thd, &table_list))
DBUG_RETURN(1); // Thread was killed
@@ -2645,18 +2644,22 @@ static int open_unireg_entry(THD *thd, T
int error;
TABLE_SHARE *share;
uint discover_retry_count= 0;
+ uint db_flags= (table_list->requested_object == OPEN_VIEW_ONLY ?
+ OPEN_VIEW | SKIP_OPEN_TABLE : OPEN_VIEW);
DBUG_ENTER("open_unireg_entry");
safe_mutex_assert_owner(&LOCK_open);
-
retry:
if (!(share= get_table_share_with_create(thd, table_list, cache_key,
cache_key_length,
- OPEN_VIEW, &error)))
+ db_flags, &error)))
DBUG_RETURN(1);
if (share->is_view)
{
+ if (table_list->requested_object == OPEN_TABLE_ONLY)
+ goto err;
+
/* Open view */
error= (int) open_new_frm(thd, share, alias,
(uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
@@ -2671,6 +2674,9 @@ retry:
release_table_share(share, RELEASE_NORMAL);
DBUG_RETURN((flags & OPEN_VIEW_NO_PARSE)? -1 : 0);
}
+
+ if (table_list->requested_object == OPEN_VIEW_ONLY)
+ goto err;
while ((error= open_table_from_share(thd, share, alias,
(uint) (HA_OPEN_KEYFILE |
--- 1.391/sql/sql_show.cc 2007-02-13 12:30:01 +04:00
+++ 1.392/sql/sql_show.cc 2007-03-21 10:53:39 +04:00
@@ -489,13 +489,15 @@ bool mysqld_show_column_types(THD *thd)
find_files_result
-find_files(THD *thd, List<char> *files, const char *db,
+find_files(THD *thd, List<LEX_STRING> *files, const char *db,
const char *path, const char *wild, bool dir)
{
uint i;
char *ext;
MY_DIR *dirp;
FILEINFO *file;
+ LEX_STRING *file_name= 0;
+ uint file_name_len;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access=thd->col_access;
#endif
@@ -544,10 +546,16 @@ find_files(THD *thd, List<char> *files,
#endif
if (!MY_S_ISDIR(file->mystat->st_mode))
continue;
- VOID(filename_to_tablename(file->name, uname, sizeof(uname)));
+
+ file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
if (wild && wild_compare(uname, wild, 0))
continue;
- file->name= uname;
+ if (!(file_name=
+ make_lex_string(thd, file_name, uname, file_name_len, TRUE)))
+ {
+ my_dirend(dirp);
+ DBUG_RETURN(FIND_FILES_OOM);
+ }
}
else
{
@@ -556,16 +564,15 @@ find_files(THD *thd, List<char> *files,
is_prefix(file->name, tmp_file_prefix))
continue;
*ext=0;
- VOID(filename_to_tablename(file->name, uname, sizeof(uname)));
- file->name= uname;
+ file_name_len= filename_to_tablename(file->name, uname, sizeof(uname));
if (wild)
{
if (lower_case_table_names)
{
- if (wild_case_compare(files_charset_info, file->name, wild))
+ if (wild_case_compare(files_charset_info, uname, wild))
continue;
}
- else if (wild_compare(file->name,wild,0))
+ else if (wild_compare(uname, wild, 0))
continue;
}
}
@@ -575,14 +582,16 @@ find_files(THD *thd, List<char> *files,
{
table_list.db= (char*) db;
table_list.db_length= strlen(db);
- table_list.table_name= file->name;
- table_list.table_name_length= strlen(file->name);
+ table_list.table_name= uname;
+ table_list.table_name_length= file_name_len;
table_list.grant.privilege=col_access;
if (check_grant(thd, TABLE_ACLS, &table_list, 1, 1, 1))
continue;
}
#endif
- if (files->push_back(thd->strdup(file->name)))
+ if (!(file_name= make_lex_string(thd, file_name, uname,
+ file_name_len, TRUE)) ||
+ files->push_back(file_name))
{
my_dirend(dirp);
DBUG_RETURN(FIND_FILES_OOM);
@@ -591,7 +600,7 @@ find_files(THD *thd, List<char> *files,
DBUG_PRINT("info",("found: %d files", files->elements));
my_dirend(dirp);
- VOID(ha_find_files(thd,db,path,wild,dir,files));
+ VOID(ha_find_files(thd, db, path, wild, dir, files));
DBUG_RETURN(FIND_FILES_OK);
}
@@ -2183,15 +2192,42 @@ void calc_sum_of_all_status(STATUS_VAR *
}
+/*
+ Create LEX_STRING
+
+ SYNOPSIS
+ make_lex_string()
+ thd thread handler
+ lex_str LEX_STRING
+ str string
+ length string length
+ allocate_lex_string allocate LEX_STRING struct if TRUE
+
+ RETURN
+ 0 error
+ # pointer to LEX_STRING
+*/
+
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
const char* str, uint length,
bool allocate_lex_string)
{
+ char *tmp_str;
+ LEX_STRING *tmp_lex_str;
MEM_ROOT *mem= thd->mem_root;
if (allocate_lex_string)
- if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
+ {
+ if (!multi_alloc_root(mem, &tmp_lex_str, sizeof(LEX_STRING),
+ &tmp_str, length + 1, NullS))
return 0;
- lex_str->str= strmake_root(mem, str, length);
+ memcpy(tmp_str, str, length);
+ tmp_str[length]= 0;
+ tmp_lex_str->str= tmp_str;
+ tmp_lex_str->length= length;
+ return tmp_lex_str;
+ }
+ if (!(lex_str->str= strmake_root(mem, str, length)))
+ return 0;
lex_str->length= length;
return lex_str;
}
@@ -2205,7 +2241,8 @@ extern ST_SCHEMA_TABLE schema_tables[];
typedef struct st_index_field_values
{
- const char *db_value, *table_value;
+ LEX_STRING db_value, table_value;
+ bool wild_db_value, wild_table_value;
} INDEX_FIELD_VALUES;
@@ -2237,38 +2274,11 @@ bool schema_table_store_record(THD *thd,
}
-void get_index_field_values(LEX *lex, INDEX_FIELD_VALUES *index_field_values)
-{
- const char *wild= lex->wild ? lex->wild->ptr() : NullS;
- switch (lex->sql_command) {
- case SQLCOM_SHOW_DATABASES:
- index_field_values->db_value= wild;
- break;
- case SQLCOM_SHOW_TABLES:
- case SQLCOM_SHOW_TABLE_STATUS:
- case SQLCOM_SHOW_TRIGGERS:
- case SQLCOM_SHOW_EVENTS:
- index_field_values->db_value= lex->select_lex.db;
- index_field_values->table_value= wild;
- break;
- default:
- index_field_values->db_value= NullS;
- index_field_values->table_value= NullS;
- break;
- }
-}
-
-
int make_table_list(THD *thd, SELECT_LEX *sel,
- char *db, char *table)
+ LEX_STRING *db_name, LEX_STRING *table_name)
{
Table_ident *table_ident;
- LEX_STRING ident_db, ident_table;
- ident_db.str= db;
- ident_db.length= strlen(db);
- ident_table.str= table;
- ident_table.length= strlen(table);
- table_ident= new Table_ident(thd, ident_db, ident_table, 1);
+ table_ident= new Table_ident(thd, *db_name, *table_name, 1);
sel->init_query();
if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ,
(List<String> *) 0, (List<String> *) 0))
@@ -2277,6 +2287,124 @@ int make_table_list(THD *thd, SELECT_LEX
}
+/*
+ Get lookup value from the part of 'WHERE' condition
+ if it's possible
+
+
+ SYNOPSIS
+ get_idx_val()
+ thd thread handler
+ item_func part of WHERE condition
+ table I_S table
+ idx_field_vals Struct which holds lookup values
+
+ RETURN
+ void
+*/
+
+void get_idx_val(THD *thd, Item_func *item_func, TABLE_LIST *table,
+ INDEX_FIELD_VALUES *idx_field_vals)
+{
+ ST_SCHEMA_TABLE *schema_table= table->schema_table;
+ ST_FIELD_INFO *field_info= schema_table->fields_info;
+ const char *field_name1= schema_table->idx_field1 >= 0 ?
+ field_info[schema_table->idx_field1].field_name : "";
+ const char *field_name2= schema_table->idx_field2 >= 0 ?
+ field_info[schema_table->idx_field2].field_name : "";
+
+ if (item_func->functype() == Item_func::EQ_FUNC)
+ {
+ int idx_field, idx_val;
+ char tmp[MAX_FIELD_WIDTH];
+ String *tmp_str, str_buff(tmp, sizeof(tmp), system_charset_info);
+ Item_field *item_field;
+ CHARSET_INFO *cs= system_charset_info;
+
+ if (item_func->arguments()[0]->type() == Item::FIELD_ITEM &&
+ item_func->arguments()[1]->const_item())
+ {
+ idx_field= 0;
+ idx_val= 1;
+ }
+ else if (item_func->arguments()[1]->type() == Item::FIELD_ITEM &&
+ item_func->arguments()[0]->const_item())
+ {
+ idx_field= 1;
+ idx_val= 0;
+ }
+ else
+ return;
+
+ item_field= (Item_field*) item_func->arguments()[idx_field];
+ tmp_str= item_func->arguments()[idx_val]->val_str(&str_buff);
+ if (table->table != item_field->field->table)
+ return;
+
+ if (!cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
+ (uchar *) item_field->field_name,
+ strlen(item_field->field_name), 0))
+ {
+ idx_field_vals->db_value.str= thd->strmake(tmp_str->ptr(),
+ tmp_str->length());
+ idx_field_vals->db_value.length= tmp_str->length();
+ }
+ else if (!cs->coll->strnncollsp(cs, (uchar *) field_name2,
+ strlen(field_name2),
+ (uchar *) item_field->field_name,
+ strlen(item_field->field_name), 0))
+ {
+ idx_field_vals->table_value.str= thd->strmake(tmp_str->ptr(),
+ tmp_str->length());
+ idx_field_vals->table_value.length= tmp_str->length();
+ }
+ }
+ return;
+}
+
+
+/*
+ Get lookup values from 'WHERE' condition
+ if it's possible
+
+
+ SYNOPSIS
+ calc_idx_values_from_cond()
+ thd thread handler
+ cond WHERE condition
+ table I_S table
+ idx_field_vals Struct which holds lookup values
+
+ RETURN
+ void
+*/
+
+void calc_idx_values_from_cond(THD *thd, COND *cond, TABLE_LIST *table,
+ INDEX_FIELD_VALUES *idx_field_vals)
+{
+ if (!cond)
+ return;
+
+ if (cond->type() == Item::COND_ITEM)
+ {
+ if (((Item_cond*) cond)->functype() == Item_func::COND_AND_FUNC)
+ {
+ List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
+ Item *item;
+ while ((item= li++))
+ {
+ if (item->type() == Item::FUNC_ITEM)
+ get_idx_val(thd, (Item_func*)item, table, idx_field_vals);
+ }
+ }
+ return;
+ }
+ else if (cond->type() == Item::FUNC_ITEM)
+ get_idx_val(thd, (Item_func*) cond, table, idx_field_vals);
+ return;
+}
+
+
bool uses_only_table_name_fields(Item *item, TABLE_LIST *table)
{
if (item->type() == Item::FUNC_ITEM)
@@ -2296,21 +2424,23 @@ bool uses_only_table_name_fields(Item *i
CHARSET_INFO *cs= system_charset_info;
ST_SCHEMA_TABLE *schema_table= table->schema_table;
ST_FIELD_INFO *field_info= schema_table->fields_info;
- const char *field_name1= schema_table->idx_field1 >= 0 ?
field_info[schema_table->idx_field1].field_name : "";
- const char *field_name2= schema_table->idx_field2 >= 0 ?
field_info[schema_table->idx_field2].field_name : "";
+ const char *field_name1= schema_table->idx_field1 >= 0 ?
+ field_info[schema_table->idx_field1].field_name : "";
+ const char *field_name2= schema_table->idx_field2 >= 0 ?
+ field_info[schema_table->idx_field2].field_name : "";
if (table->table != item_field->field->table ||
(cs->coll->strnncollsp(cs, (uchar *) field_name1, strlen(field_name1),
- (uchar *) item_field->field_name,
+ (uchar *) item_field->field_name,
strlen(item_field->field_name), 0) &&
cs->coll->strnncollsp(cs, (uchar *) field_name2, strlen(field_name2),
- (uchar *) item_field->field_name,
+ (uchar *) item_field->field_name,
strlen(item_field->field_name), 0)))
return 0;
}
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->const_item())
return 0;
return 1;
@@ -2373,6 +2503,56 @@ static COND * make_cond_for_info_schema(
}
+/*
+ Get lookup values from 'WHERE' condition or
+ wild values(for 'SHOW' commands only)
+
+
+ SYNOPSIS
+ get_index_field_values()
+ thd thread handler
+ cond WHERE condition
+ table I_S table
+ idx_field_vals Struct which holds lookup values
+
+ RETURN
+ void
+*/
+
+void get_index_field_values(THD *thd, COND *cond, TABLE_LIST *tables,
+ INDEX_FIELD_VALUES *index_field_values)
+{
+ LEX *lex= thd->lex;
+ const char *wild= lex->wild ? lex->wild->ptr() : NullS;
+ bzero((char*) index_field_values, sizeof(INDEX_FIELD_VALUES));
+ switch (lex->sql_command) {
+ case SQLCOM_SHOW_DATABASES:
+ if (wild)
+ {
+ index_field_values->db_value.str= (char*) wild;
+ index_field_values->db_value.length= strlen(wild);
+ index_field_values->wild_db_value= 1;
+ }
+ break;
+ case SQLCOM_SHOW_TABLES:
+ case SQLCOM_SHOW_TABLE_STATUS:
+ case SQLCOM_SHOW_TRIGGERS:
+ case SQLCOM_SHOW_EVENTS:
+ index_field_values->db_value.str= lex->select_lex.db;
+ index_field_values->db_value.length=strlen(lex->select_lex.db);
+ if (wild)
+ {
+ index_field_values->table_value.str= (char*)wild;
+ index_field_values->table_value.length= strlen(wild);
+ index_field_values->wild_table_value= 1;
+ }
+ break;
+ default:
+ calc_idx_values_from_cond(thd, cond, tables, index_field_values);
+ break;
+ }
+}
+
enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table)
{
return (enum enum_schema_tables) (schema_table - &schema_tables[0]);
@@ -2399,54 +2579,61 @@ enum enum_schema_tables get_schema_table
non-zero error
*/
-int make_db_list(THD *thd, List<char> *files,
+int make_db_list(THD *thd, List<LEX_STRING> *files,
INDEX_FIELD_VALUES *idx_field_vals,
bool *with_i_schema, bool is_wild_value)
{
- LEX *lex= thd->lex;
*with_i_schema= 0;
- get_index_field_values(lex, idx_field_vals);
- if (is_wild_value)
+ if (idx_field_vals->wild_db_value)
{
/*
This part of code is only for SHOW DATABASES command.
idx_field_vals->db_value can be 0 when we don't use
LIKE clause (see also get_index_field_values() function)
*/
- if (!idx_field_vals->db_value ||
+ if (!idx_field_vals->db_value.str ||
!wild_case_compare(system_charset_info,
information_schema_name.str,
- idx_field_vals->db_value))
+ idx_field_vals->db_value.str))
{
*with_i_schema= 1;
- if (files->push_back(thd->strdup(information_schema_name.str)))
+ if (files->push_back(&information_schema_name))
return 1;
}
return (find_files(thd, files, NullS, mysql_data_home,
- idx_field_vals->db_value, 1) != FIND_FILES_OK);
+ idx_field_vals->db_value.str, 1) != FIND_FILES_OK);
}
+
/*
This part of code is for SHOW TABLES, SHOW TABLE STATUS commands.
idx_field_vals->db_value can't be 0 (see get_index_field_values()
function).
*/
- if (sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
+ if (idx_field_vals->db_value.str)
{
if (!my_strcasecmp(system_charset_info, information_schema_name.str,
- idx_field_vals->db_value))
+ idx_field_vals->db_value.str))
{
*with_i_schema= 1;
- return files->push_back(thd->strdup(information_schema_name.str));
+ if (files->push_back(&information_schema_name))
+ return 1;
}
- return files->push_back(thd->strdup(idx_field_vals->db_value));
+ else
+ {
+ if (files->push_back(&idx_field_vals->db_value))
+ return 1;
+ }
+ VOID(ha_find_files(thd, NullS, mysql_data_home,
+ idx_field_vals->db_value.str, 1, files));
+ return 0;
}
/*
Create list of existing databases. It is used in case
of select from information schema table
*/
- if (files->push_back(thd->strdup(information_schema_name.str)))
+ if (files->push_back(&information_schema_name))
return 1;
*with_i_schema= 1;
return (find_files(thd, files, NullS,
@@ -2455,15 +2642,16 @@ int make_db_list(THD *thd, List<char> *f
struct st_add_schema_table
{
- List<char> *files;
+ List<LEX_STRING> *files;
const char *wild;
};
static my_bool add_schema_table(THD *thd, st_plugin_int *plugin,
void* p_data)
{
+ LEX_STRING *file_name= 0;
st_add_schema_table *data= (st_add_schema_table *)p_data;
- List<char> *file_list= data->files;
+ List<LEX_STRING> *file_list= data->files;
const char *wild= data->wild;
ST_SCHEMA_TABLE *schema_table= (ST_SCHEMA_TABLE *)plugin->data;
DBUG_ENTER("add_schema_table");
@@ -2483,14 +2671,17 @@ static my_bool add_schema_table(THD *thd
DBUG_RETURN(0);
}
- if (file_list->push_back(thd->strdup(schema_table->table_name)))
- DBUG_RETURN(1);
-
- DBUG_RETURN(0);
+ if ((file_name= make_lex_string(thd, file_name, schema_table->table_name,
+ strlen(schema_table->table_name), TRUE)) &&
+ !file_list->push_back(file_name))
+ DBUG_RETURN(0);
+ DBUG_RETURN(1);
}
-int schema_tables_add(THD *thd, List<char> *files, const char *wild)
+
+int schema_tables_add(THD *thd, List<LEX_STRING> *files, const char *wild)
{
+ LEX_STRING *file_name= 0;
ST_SCHEMA_TABLE *tmp_schema_table= schema_tables;
st_add_schema_table add_data;
DBUG_ENTER("schema_tables_add");
@@ -2511,8 +2702,12 @@ int schema_tables_add(THD *thd, List<cha
else if (wild_compare(tmp_schema_table->table_name, wild, 0))
continue;
}
- if (files->push_back(thd->strdup(tmp_schema_table->table_name)))
- DBUG_RETURN(1);
+ if ((file_name= make_lex_string(thd, file_name,
+ tmp_schema_table->table_name,
+ strlen(tmp_schema_table->table_name),
+ TRUE)) && !files->push_back(file_name))
+ continue;
+ DBUG_RETURN(1);
}
add_data.files= files;
@@ -2525,38 +2720,352 @@ int schema_tables_add(THD *thd, List<cha
}
+/*
+ Create table names list.
+
+ SYNOPSIS
+ make_file_list()
+ thd thread handler
+ files List of tables in databases
+ lex LEX struc
+ wild wild string
+ idx_field_vals idx_field_vals->db_name contains db name or
+ wild string
+ with_i_schema Returns 1 if we added 'IS' name to list
+ otherwise returns 0
+ db_name database name
+
+ RETURN
+ zero success
+ 1 fatal error
+ 2 Not fatal error; Safe to ignore this file list
+*/
+
+int make_file_list(THD *thd, List<LEX_STRING> *files, LEX *lex,
+ INDEX_FIELD_VALUES *idx_field_vals,
+ bool with_i_schema, LEX_STRING *db_name)
+{
+ char path[FN_REFLEN];
+ build_table_filename(path, sizeof(path), db_name->str, "", "", 0);
+ if (!idx_field_vals->wild_table_value &&
+ idx_field_vals->table_value.str)
+ {
+ if (with_i_schema)
+ {
+ if (find_schema_table(thd, idx_field_vals->table_value.str))
+ {
+ if (files->push_back(&idx_field_vals->table_value))
+ return 1;
+ }
+ }
+ else
+ {
+ if (files->push_back(&idx_field_vals->table_value))
+ return 1;
+ }
+ VOID(ha_find_files(thd, db_name->str, path, idx_field_vals->table_value.str,
+ 0, files));
+ return 0;
+ }
+
+ if (with_i_schema) // information schema table names
+ {
+ return (schema_tables_add(thd, files, idx_field_vals->table_value.str));
+ }
+
+ find_files_result res= find_files(thd, files, db_name->str, path,
+ idx_field_vals->table_value.str, 0);
+ if (res != FIND_FILES_OK)
+ {
+ /*
+ Downgrade errors about problems with database directory to
+ warnings if this is not a 'SHOW' command. Another thread
+ may have dropped database, and we may still have a name
+ for that directory.
+ */
+ if (res == FIND_FILES_DIR)
+ {
+ if (lex->sql_command != SQLCOM_SELECT)
+ return 1;
+ thd->clear_error();
+ return 2;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ Fill I_S table for SHOW COLUMNS|INDEX commands
+
+ SYNOPSIS
+ fill_schema_show()
+ thd thread handler
+ lex LEX struct
+ tables TABLE_LIST for I_S table
+ open_tables_state_backup Open_tables_state struct
+
+ RETURN
+ zero success
+ non-zero error
+*/
+
+static int fill_schema_show(THD *thd, LEX *lex, TABLE_LIST *tables,
+ ST_SCHEMA_TABLE *schema_table,
+ Open_tables_state *open_tables_state_backup)
+{
+ bool res;
+ LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name;
+ enum_sql_command save_sql_command= lex->sql_command;
+ TABLE_LIST *show_table_list= (TABLE_LIST*) tables->schema_select_lex->
+ table_list.first;
+ TABLE *table= tables->table;
+ int error= 1;
+ DBUG_ENTER("fill_schema_show");
+
+ lex->all_selects_list= tables->schema_select_lex;
+ /*
+ Restore thd->temporary_tables to be able to process
+ temporary tables(only for 'show index' & 'show columns').
+ This should be changed when processing of temporary tables for
+ I_S tables will be done.
+ */
+ thd->temporary_tables= open_tables_state_backup->temporary_tables;
+ /*
+ Let us set fake sql_command so views won't try to merge
+ themselves into main statement. If we don't do this,
+ SELECT * from information_schema.xxxx will cause problems.
+ SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
+ */
+ lex->sql_command= SQLCOM_SHOW_FIELDS;
+ res= open_normal_and_derived_tables(thd, show_table_list,
+ MYSQL_LOCK_IGNORE_FLUSH);
+ lex->sql_command= save_sql_command;
+ /*
+ get_all_tables() returns 1 on failure and 0 on success thus
+ return only these and not the result code of ::process_table()
+
+ We should use show_table_list->alias instead of
+ show_table_list->table_name because table_name
+ could be changed during opening of I_S tables. It's safe
+ to use alias because alias contains original table name
+ in this case(this part of code is used only for
+ 'show columns' & 'show statistics' commands).
+ */
+ db_name= &show_table_list->view_db;
+ table_name= make_lex_string(thd, &tmp_lex_string1,
+ show_table_list->alias,
+ strlen(show_table_list->alias), FALSE);
+ if (!show_table_list->view)
+ db_name= make_lex_string(thd, &tmp_lex_string,
+ show_table_list->db,
+ show_table_list->db_length, FALSE);
+
+
+ error= test(schema_table->process_table(thd, show_table_list,
+ table, res, db_name,
+ table_name));
+ thd->temporary_tables= 0;
+ close_tables_for_reopen(thd, &show_table_list);
+ DBUG_RETURN(error);
+}
+
+
+/*
+ Fill I_S table for SHOW TABLE NAMES commands
+
+ SYNOPSIS
+ fill_schema_table_names()
+ thd thread handler
+ lex LEX struct
+ table TABLE struct for I_S table
+ db_name database name
+ table_name table name
+ with_i_schema I_S table if TRUE
+
+ RETURN
+ zero success
+ non-zero error
+*/
+
+static int fill_schema_table_names(THD *thd, LEX *lex, TABLE *table,
+ LEX_STRING *db_name, LEX_STRING *table_name,
+ bool with_i_schema)
+{
+ if (with_i_schema)
+ {
+ table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
+ system_charset_info);
+ }
+ else
+ {
+ enum legacy_db_type not_used;
+ char path[FN_REFLEN];
+ (void) build_table_filename(path, sizeof(path), db_name->str,
+ table_name->str, reg_ext, 0);
+ switch (mysql_frm_type(thd, path, ¬_used)) {
+ case FRMTYPE_ERROR:
+ table->field[3]->store(STRING_WITH_LEN("ERROR"),
+ system_charset_info);
+ break;
+ case FRMTYPE_TABLE:
+ table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
+ system_charset_info);
+ break;
+ case FRMTYPE_VIEW:
+ table->field[3]->store(STRING_WITH_LEN("VIEW"),
+ system_charset_info);
+ break;
+ default:
+ DBUG_ASSERT(0);
+ }
+ if (thd->net.last_errno == ER_NO_SUCH_TABLE)
+ {
+ thd->clear_error();
+ return 0;
+ }
+ }
+ if (schema_table_store_record(thd, table))
+ return 1;
+ return 0;
+}
+
+
+/*
+ Setup open table method
+
+ SYNOPSIS
+ setup_table_open_method()
+ tables I_S table table_list
+ schema_table I_S table struct
+ schema_table_idx I_S table index
+
+ RETURN
+ zero success
+ non-zero error
+*/
+
+static uint setup_table_open_method(TABLE_LIST *tables,
+ ST_SCHEMA_TABLE *schema_table,
+ enum enum_schema_tables schema_table_idx)
+{
+ /*
+ determine which method will be used for table opening
+ */
+ if (schema_table_idx == SCH_TABLES ||
+ schema_table_idx == SCH_STATISTICS ||
+ schema_table_idx == SCH_COLUMNS)
+ {
+ Field **ptr, *field;
+ int table_open_method= 0, field_indx= 0;
+ for (ptr=tables->table->field; (field= *ptr) ; ptr++)
+ {
+ if (bitmap_is_set(tables->table->read_set, field->field_index))
+ table_open_method|= schema_table->fields_info[field_indx].open_method;
+ field_indx++;
+ }
+ return table_open_method;
+ }
+ return (uint) OPEN_FULL_TABLE;
+}
+
+/*
+ Fill I_S table with data from FRM file only
+
+ SYNOPSIS
+ fill_shema_table_from_frm()
+ thd thread handler
+ table TABLE struct for I_S table
+ schema_table I_S table struct
+ db_name database name
+ table_name table name
+ schema_table_idx I_S table index
+ RETURN
+ 0 Table is processed and we can continue
+ with new table
+ 1 It's view and we have to
+ use open_tables function for this table
+*/
+
+static int fill_shema_table_from_frm(THD *thd,TABLE *table,
+ ST_SCHEMA_TABLE *schema_table,
+ LEX_STRING *db_name,
+ LEX_STRING *table_name,
+ enum enum_schema_tables schema_table_idx)
+{
+ TABLE_SHARE share;
+ TABLE tbl;
+ TABLE_LIST table_list;
+ char path[FN_REFLEN];
+ uint res;
+ bzero((char*) &table_list, sizeof(TABLE_LIST));
+ bzero((char*) &tbl, sizeof(TABLE));
+ (void) build_table_filename(path, sizeof(path), db_name->str,
+ table_name->str, "", 0);
+ init_tmp_table_share(&share, "", 0, "", path);
+ if (!(res= open_table_def(thd, &share, OPEN_VIEW)))
+ {
+ share.tmp_table= NO_TMP_TABLE;
+ tbl.s= &share;
+ table_list.table= &tbl;
+ if (schema_table_idx == SCH_STATISTICS ||
+ schema_table_idx == SCH_COLUMNS)
+ {
+ if (share.is_view ||
+ open_table_from_share(thd, &share, table_name->str, 0,
+ (READ_KEYINFO | COMPUTE_TYPES |
+ EXTRA_RECORD | OPEN_FRM_FILE_ONLY),
+ thd->open_options, &tbl, FALSE))
+ {
+ share.tmp_table= INTERNAL_TMP_TABLE;
+ free_table_share(&share);
+ return (share.is_view &&
+ schema_table->requested_object == OPEN_VIEW_OR_TABLE);
+ }
+ }
+ table_list.view= (st_lex*) share.is_view;
+ res= schema_table->process_table(thd, &table_list, table,
+ res, db_name, table_name);
+ share.tmp_table= INTERNAL_TMP_TABLE;
+ if (schema_table_idx == SCH_STATISTICS ||
+ schema_table_idx == SCH_COLUMNS)
+ closefrm(&tbl, true);
+ else
+ free_table_share(&share);
+ }
+
+ if (res)
+ thd->clear_error();
+ return 0;
+}
+
+
int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
{
LEX *lex= thd->lex;
TABLE *table= tables->table;
- SELECT_LEX *select_lex= &lex->select_lex;
SELECT_LEX *old_all_select_lex= lex->all_selects_list;
enum_sql_command save_sql_command= lex->sql_command;
- SELECT_LEX *lsel= tables->schema_select_lex;
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
SELECT_LEX sel;
INDEX_FIELD_VALUES idx_field_vals;
- char path[FN_REFLEN], *end, *base_name, *orig_base_name, *file_name;
- uint len;
+ LEX_STRING *db_name, *table_name;
bool with_i_schema;
enum enum_schema_tables schema_table_idx;
- List<char> bases;
- List_iterator_fast<char> it(bases);
+ List<LEX_STRING> bases;
+ List_iterator_fast<LEX_STRING> it(bases);
COND *partial_cond;
uint derived_tables= lex->derived_tables;
int error= 1;
- enum legacy_db_type not_used;
Open_tables_state open_tables_state_backup;
bool save_view_prepare_mode= lex->view_prepare_mode;
Query_tables_list query_tables_list_backup;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
#endif
+ uint table_open_method;
DBUG_ENTER("get_all_tables");
- LINT_INIT(end);
- LINT_INIT(len);
-
lex->view_prepare_mode= TRUE;
lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
@@ -2567,174 +3076,118 @@ int get_all_tables(THD *thd, TABLE_LIST
*/
thd->reset_n_backup_open_tables_state(&open_tables_state_backup);
- if (lsel)
- {
- TABLE_LIST *show_table_list= (TABLE_LIST*) lsel->table_list.first;
- bool res;
- lex->all_selects_list= lsel;
- /*
- Restore thd->temporary_tables to be able to process
- temporary tables(only for 'show index' & 'show columns').
- This should be changed when processing of temporary tables for
- I_S tables will be done.
- */
- thd->temporary_tables= open_tables_state_backup.temporary_tables;
- /*
- Let us set fake sql_command so views won't try to merge
- themselves into main statement. If we don't do this,
- SELECT * from information_schema.xxxx will cause problems.
- SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
- */
- lex->sql_command= SQLCOM_SHOW_FIELDS;
- res= open_normal_and_derived_tables(thd, show_table_list,
- MYSQL_LOCK_IGNORE_FLUSH);
- lex->sql_command= save_sql_command;
- /*
- get_all_tables() returns 1 on failure and 0 on success thus
- return only these and not the result code of ::process_table()
-
- We should use show_table_list->alias instead of
- show_table_list->table_name because table_name
- could be changed during opening of I_S tables. It's safe
- to use alias because alias contains original table name
- in this case(this part of code is used only for
- 'show columns' & 'show statistics' commands).
- */
- error= test(schema_table->process_table(thd, show_table_list,
- table, res,
- (show_table_list->view ?
- show_table_list->view_db.str :
- show_table_list->db),
- show_table_list->alias));
- thd->temporary_tables= 0;
- close_tables_for_reopen(thd, &show_table_list);
+ /* SHOW FIELDS, SHOW INDEXES */
+ if (tables->schema_select_lex)
+ {
+ error= fill_schema_show(thd, lex, tables, schema_table,
+ &open_tables_state_backup);
goto err;
}
schema_table_idx= get_schema_table_idx(schema_table);
+ get_index_field_values(thd, cond, tables, &idx_field_vals);
+ DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
+ idx_field_vals.db_value.str,
+ idx_field_vals.table_value.str));
+ if (idx_field_vals.db_value.length &&
+ !idx_field_vals.wild_db_value &&
+ idx_field_vals.table_value.length &&
+ !idx_field_vals.wild_table_value)
+ partial_cond= 0;
+ else
+ partial_cond= make_cond_for_info_schema(cond, tables);
+
+ table_open_method= setup_table_open_method(tables, schema_table,
+ schema_table_idx);
if (make_db_list(thd, &bases, &idx_field_vals,
&with_i_schema, 0))
goto err;
-
- partial_cond= make_cond_for_info_schema(cond, tables);
it.rewind(); /* To get access to new elements in basis list */
-
- /*
- Below we generate error for non existing database.
- (to save old behaviour for SHOW TABLES FROM db)
- */
- while ((orig_base_name= base_name= it++) ||
- ((sql_command_flags[save_sql_command] & CF_SHOW_TABLE_COMMAND) &&
- (base_name= select_lex->db) && !bases.elements))
+ while ((db_name= it++))
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
- if (!check_access(thd,SELECT_ACL, base_name,
+ if (!check_access(thd,SELECT_ACL, db_name->str,
&thd->col_access, 0, 1, with_i_schema) ||
sctx->master_access & (DB_ACLS | SHOW_DB_ACL) ||
- acl_get(sctx->host, sctx->ip, sctx->priv_user, base_name,0) ||
- (grant_option && !check_grant_db(thd, base_name)))
+ acl_get(sctx->host, sctx->ip, sctx->priv_user, db_name->str, 0) ||
+ (grant_option && !check_grant_db(thd, db_name->str)))
#endif
{
- List<char> files;
- if (with_i_schema) // information schema table names
- {
- if (schema_tables_add(thd, &files, idx_field_vals.table_value))
- goto err;
- }
- else
+ thd->no_warnings_for_error= 1;
+ List<LEX_STRING> files;
+ int res= make_file_list(thd, &files, lex, &idx_field_vals,
+ with_i_schema, db_name);
+ if (res == 2) /* Not fatal error, continue */
+ continue;
+ if (res)
+ goto err;
+
+ List_iterator_fast<LEX_STRING> it_files(files);
+ while ((table_name= it_files++))
{
- len= build_table_filename(path, sizeof(path), base_name, "", "", 0);
- end= path + len;
- len= FN_LEN - len;
- find_files_result res= find_files(thd, &files, base_name,
- path, idx_field_vals.table_value, 0);
- if (res != FIND_FILES_OK)
+ restore_record(table, s->default_values);
+ table->field[schema_table->idx_field1]->
+ store(db_name->str, db_name->length, system_charset_info);
+ table->field[schema_table->idx_field2]->
+ store(table_name->str, table_name->length, system_charset_info);
+
+ if (!partial_cond || partial_cond->val_int())
{
/*
- Downgrade errors about problems with database directory to
- warnings if this is not a 'SHOW' command. Another thread
- may have dropped database, and we may still have a name
- for that directory.
+ If table is I_S.tables and open_table_method is 0 (eg SKIP_OPEN)
+ we can skip table opening and we don't have index value for
+ table name.
*/
- if (res == FIND_FILES_DIR && lex->sql_command == SQLCOM_END)
+ if (!table_open_method && schema_table_idx == SCH_TABLES &&
+ !idx_field_vals.table_value.length)
{
- push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- thd->net.last_errno, thd->net.last_error);
- thd->clear_error();
+ if (schema_table_store_record(thd, table))
+ goto err; /* Out of space in temporary table */
continue;
}
- else
- {
- goto err;
- }
- }
- if (lower_case_table_names)
- orig_base_name= thd->strdup(base_name);
- }
- List_iterator_fast<char> it_files(files);
- while ((file_name= it_files++))
- {
- restore_record(table, s->default_values);
- table->field[schema_table->idx_field1]->
- store(base_name, strlen(base_name), system_charset_info);
- table->field[schema_table->idx_field2]->
- store(file_name, strlen(file_name),system_charset_info);
- if (!partial_cond || partial_cond->val_int())
- {
+ /* SHOW TABLE NAMES command */
if (schema_table_idx == SCH_TABLE_NAMES)
{
- if (lex->verbose ||
- (sql_command_flags[save_sql_command] & CF_STATUS_COMMAND) == 0)
- {
- if (with_i_schema)
- {
- table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
- system_charset_info);
- }
- else
- {
- my_snprintf(end, len, "/%s%s", file_name, reg_ext);
- switch (mysql_frm_type(thd, path, ¬_used)) {
- case FRMTYPE_ERROR:
- table->field[3]->store(STRING_WITH_LEN("ERROR"),
- system_charset_info);
- break;
- case FRMTYPE_TABLE:
- table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
- system_charset_info);
- break;
- case FRMTYPE_VIEW:
- table->field[3]->store(STRING_WITH_LEN("VIEW"),
- system_charset_info);
- break;
- default:
- DBUG_ASSERT(0);
- }
- }
- }
- if (schema_table_store_record(thd, table))
+ if (fill_schema_table_names(thd, lex, tables->table, db_name,
+ table_name, with_i_schema))
goto err;
}
else
{
+ if (!(table_open_method & ~OPEN_FRM_ONLY) &&
+ !with_i_schema)
+ {
+ if (!fill_shema_table_from_frm(thd, table, schema_table, db_name,
+ table_name, schema_table_idx))
+ continue;
+ }
+
int res;
+ LEX_STRING tmp_lex_string, orig_db_name;
/*
Set the parent lex of 'sel' because it is needed by
sel.init_query() which is called inside make_table_list.
*/
+ thd->no_warnings_for_error= 1;
sel.parent_lex= lex;
- if (make_table_list(thd, &sel, base_name, file_name))
+ /* db_name can be changed in make_table_list() func */
+ if (!make_lex_string(thd, &orig_db_name, db_name->str,
+ db_name->length, FALSE))
+ goto err;
+ if (make_table_list(thd, &sel, db_name, table_name))
goto err;
TABLE_LIST *show_table_list= (TABLE_LIST*) sel.table_list.first;
lex->all_selects_list= &sel;
lex->derived_tables= 0;
lex->sql_command= SQLCOM_SHOW_FIELDS;
+ show_table_list->requested_object= schema_table->requested_object;
res= open_normal_and_derived_tables(thd, show_table_list,
MYSQL_LOCK_IGNORE_FLUSH);
lex->sql_command= save_sql_command;
+
/*
We should use show_table_list->alias instead of
show_table_list->table_name because table_name
@@ -2742,10 +3195,21 @@ int get_all_tables(THD *thd, TABLE_LIST
to use alias because alias contains original table name
in this case.
*/
- res= schema_table->process_table(thd, show_table_list, table,
- res, orig_base_name,
- show_table_list->alias);
- close_tables_for_reopen(thd, &show_table_list);
+ if (thd->net.last_errno == ER_NO_SUCH_TABLE)
+ {
+ /* Hide error for not existing table */
+ res= 0;
+ thd->clear_error();
+ }
+ else
+ {
+ make_lex_string(thd, &tmp_lex_string, show_table_list->alias,
+ strlen(show_table_list->alias), FALSE);
+ res= schema_table->process_table(thd, show_table_list, table,
+ res, &orig_db_name,
+ &tmp_lex_string);
+ close_tables_for_reopen(thd, &show_table_list);
+ }
DBUG_ASSERT(!lex->query_tables_own_last);
if (res)
goto err;
@@ -2772,11 +3236,11 @@ err:
}
-bool store_schema_shemata(THD* thd, TABLE *table, const char *db_name,
+bool store_schema_shemata(THD* thd, TABLE *table, LEX_STRING *db_name,
CHARSET_INFO *cs)
{
restore_record(table, s->default_values);
- table->field[1]->store(db_name, strlen(db_name), system_charset_info);
+ table->field[1]->store(db_name->str, db_name->length, system_charset_info);
table->field[2]->store(cs->csname, strlen(cs->csname),
system_charset_info);
table->field[3]->store(cs->name, strlen(cs->name), system_charset_info);
return schema_table_store_record(thd, table);
@@ -2791,8 +3255,8 @@ int fill_schema_shemata(THD *thd, TABLE_
*/
INDEX_FIELD_VALUES idx_field_vals;
- List<char> files;
- char *file_name;
+ List<LEX_STRING> files;
+ LEX_STRING *file_name;
bool with_i_schema;
HA_CREATE_INFO create;
TABLE *table= tables->table;
@@ -2801,11 +3265,15 @@ int fill_schema_shemata(THD *thd, TABLE_
#endif
DBUG_ENTER("fill_schema_shemata");
+ get_index_field_values(thd, cond, tables, &idx_field_vals);
+ DBUG_PRINT("INDEX VALUES",("db_name='%s', table_name='%s'",
+ idx_field_vals.db_value.str,
+ idx_field_vals.table_value.str));
if (make_db_list(thd, &files, &idx_field_vals,
&with_i_schema, 1))
DBUG_RETURN(1);
- List_iterator_fast<char> it(files);
+ List_iterator_fast<LEX_STRING> it(files);
while ((file_name=it++))
{
if (with_i_schema) // information schema name is always first in list
@@ -2818,12 +3286,11 @@ int fill_schema_shemata(THD *thd, TABLE_
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (sctx->master_access & (DB_ACLS | SHOW_DB_ACL) ||
- acl_get(sctx->host, sctx->ip, sctx->priv_user, file_name,0) ||
- (grant_option && !check_grant_db(thd, file_name)))
+ acl_get(sctx->host, sctx->ip, sctx->priv_user, file_name->str,0) ||
+ (grant_option && !check_grant_db(thd, file_name->str)))
#endif
{
- load_db_opt_by_name(thd, file_name, &create);
-
+ load_db_opt_by_name(thd, file_name->str, &create);
if (store_schema_shemata(thd, table, file_name,
create.default_table_charset))
DBUG_RETURN(1);
@@ -2835,8 +3302,8 @@ int fill_schema_shemata(THD *thd, TABLE_
static int get_schema_tables_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
const char *tmp_buff;
TIME time;
@@ -2844,8 +3311,8 @@ static int get_schema_tables_record(THD
DBUG_ENTER("get_schema_tables_record");
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[2]->store(table_name->str, table_name->length, cs);
if (res)
{
/*
@@ -2868,12 +3335,11 @@ static int get_schema_tables_record(THD
}
else
{
+ char option_buff[350],*ptr;
TABLE *show_table= tables->table;
TABLE_SHARE *share= show_table->s;
handler *file= show_table->file;
-
- file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
- HA_STATUS_NO_LOCK);
+ handlerton *tmp_db_type= share->db_type;
if (share->tmp_table == SYSTEM_TMP_TABLE)
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"), cs);
else if (share->tmp_table)
@@ -2887,88 +3353,15 @@ static int get_schema_tables_record(THD
continue;
table->field[i]->set_notnull();
}
- tmp_buff= file->table_type();
+#ifdef WITH_PARTITION_STORAGE_ENGINE
+ if (share->db_type == partition_hton &&
+ share->partition_info_len)
+ tmp_db_type= share->default_part_db_type;
+#endif
+ tmp_buff= ha_get_storage_engine(ha_legacy_type(tmp_db_type));
table->field[4]->store(tmp_buff, strlen(tmp_buff), cs);
table->field[5]->store((longlong) share->frm_version, TRUE);
- enum row_type row_type = file->get_row_type();
- switch (row_type) {
- case ROW_TYPE_NOT_USED:
- case ROW_TYPE_DEFAULT:
- tmp_buff= ((share->db_options_in_use &
- HA_OPTION_COMPRESS_RECORD) ? "Compressed" :
- (share->db_options_in_use & HA_OPTION_PACK_RECORD) ?
- "Dynamic" : "Fixed");
- break;
- case ROW_TYPE_FIXED:
- tmp_buff= "Fixed";
- break;
- case ROW_TYPE_DYNAMIC:
- tmp_buff= "Dynamic";
- break;
- case ROW_TYPE_COMPRESSED:
- tmp_buff= "Compressed";
- break;
- case ROW_TYPE_REDUNDANT:
- tmp_buff= "Redundant";
- break;
- case ROW_TYPE_COMPACT:
- tmp_buff= "Compact";
- break;
- case ROW_TYPE_PAGES:
- tmp_buff= "Paged";
- break;
- }
- table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
- if (!tables->schema_table)
- {
- table->field[7]->store((longlong) file->stats.records, TRUE);
- table->field[7]->set_notnull();
- }
- table->field[8]->store((longlong) file->stats.mean_rec_length, TRUE);
- table->field[9]->store((longlong) file->stats.data_file_length, TRUE);
- if (file->stats.max_data_file_length)
- {
- table->field[10]->store((longlong) file->stats.max_data_file_length,
- TRUE);
- }
- table->field[11]->store((longlong) file->stats.index_file_length, TRUE);
- table->field[12]->store((longlong) file->stats.delete_length, TRUE);
- if (show_table->found_next_number_field)
- {
- table->field[13]->store((longlong) file->stats.auto_increment_value,
- TRUE);
- table->field[13]->set_notnull();
- }
- if (file->stats.create_time)
- {
- thd->variables.time_zone->gmt_sec_to_TIME(&time,
- file->stats.create_time);
- table->field[14]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- table->field[14]->set_notnull();
- }
- if (file->stats.update_time)
- {
- thd->variables.time_zone->gmt_sec_to_TIME(&time,
- file->stats.update_time);
- table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- table->field[15]->set_notnull();
- }
- if (file->stats.check_time)
- {
- thd->variables.time_zone->gmt_sec_to_TIME(&time,
file->stats.check_time);
- table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- table->field[16]->set_notnull();
- }
- tmp_buff= (share->table_charset ?
- share->table_charset->name : "default");
- table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
- if (file->ha_table_flags() & (ulong) HA_HAS_CHECKSUM)
- {
- table->field[18]->store((longlong) file->checksum(), TRUE);
- table->field[18]->set_notnull();
- }
- char option_buff[350],*ptr;
ptr=option_buff;
if (share->min_rows)
{
@@ -2998,27 +3391,113 @@ static int get_schema_tables_record(THD
ha_row_type[(uint) share->row_type],
NullS);
#ifdef WITH_PARTITION_STORAGE_ENGINE
- if (show_table->s->db_type == partition_hton &&
- show_table->part_info != NULL &&
- show_table->part_info->no_parts > 0)
+ if (share->db_type == partition_hton &&
+ share->partition_info_len)
ptr= strmov(ptr, " partitioned");
#endif
table->field[19]->store(option_buff+1,
(ptr == option_buff ? 0 :
(uint) (ptr-option_buff)-1), cs);
+
+ if (file)
{
- char *comment;
- comment= show_table->file->update_table_comment(share->comment.str);
- if (comment)
- {
- table->field[20]->store(comment,
- (comment == share->comment.str ?
- share->comment.length :
- strlen(comment)), cs);
- if (comment != share->comment.str)
- my_free(comment, MYF(0));
+ file->info(HA_STATUS_VARIABLE | HA_STATUS_TIME | HA_STATUS_AUTO |
+ HA_STATUS_NO_LOCK);
+
+ enum row_type row_type = file->get_row_type();
+ switch (row_type) {
+ case ROW_TYPE_NOT_USED:
+ case ROW_TYPE_DEFAULT:
+ tmp_buff= ((share->db_options_in_use &
+ HA_OPTION_COMPRESS_RECORD) ? "Compressed" :
+ (share->db_options_in_use & HA_OPTION_PACK_RECORD) ?
+ "Dynamic" : "Fixed");
+ break;
+ case ROW_TYPE_FIXED:
+ tmp_buff= "Fixed";
+ break;
+ case ROW_TYPE_DYNAMIC:
+ tmp_buff= "Dynamic";
+ break;
+ case ROW_TYPE_COMPRESSED:
+ tmp_buff= "Compressed";
+ break;
+ case ROW_TYPE_REDUNDANT:
+ tmp_buff= "Redundant";
+ break;
+ case ROW_TYPE_COMPACT:
+ tmp_buff= "Compact";
+ break;
+ case ROW_TYPE_PAGES:
+ tmp_buff= "Paged";
+ break;
+ }
+ table->field[6]->store(tmp_buff, strlen(tmp_buff), cs);
+
+ if (!tables->schema_table)
+ {
+ table->field[7]->store((longlong) file->stats.records, TRUE);
+ table->field[7]->set_notnull();
+ }
+ table->field[8]->store((longlong) file->stats.mean_rec_length, TRUE);
+ table->field[9]->store((longlong) file->stats.data_file_length, TRUE);
+ if (file->stats.max_data_file_length)
+ {
+ table->field[10]->store((longlong) file->stats.max_data_file_length,
+ TRUE);
+ }
+ table->field[11]->store((longlong) file->stats.index_file_length, TRUE);
+ table->field[12]->store((longlong) file->stats.delete_length, TRUE);
+ if (show_table->found_next_number_field)
+ {
+ table->field[13]->store((longlong) file->stats.auto_increment_value,
+ TRUE);
+ table->field[13]->set_notnull();
+ }
+ if (file->stats.create_time)
+ {
+ thd->variables.time_zone->gmt_sec_to_TIME(&time,
+ file->stats.create_time);
+ table->field[14]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
+ table->field[14]->set_notnull();
+ }
+ if (file->stats.update_time)
+ {
+ thd->variables.time_zone->gmt_sec_to_TIME(&time,
+ file->stats.update_time);
+ table->field[15]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
+ table->field[15]->set_notnull();
+ }
+ if (file->stats.check_time)
+ {
+ thd->variables.time_zone->gmt_sec_to_TIME(&time,
file->stats.check_time);
+ table->field[16]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
+ table->field[16]->set_notnull();
+ }
+
+ {
+ char *comment;
+ comment= show_table->file->update_table_comment(share->comment.str);
+ if (comment)
+ {
+ table->field[20]->store(comment,
+ (comment == share->comment.str ?
+ share->comment.length :
+ strlen(comment)), cs);
+ if (comment != share->comment.str)
+ my_free(comment, MYF(0));
+ }
+ }
+ if (file->ha_table_flags() & (ulong) HA_HAS_CHECKSUM)
+ {
+ table->field[18]->store((longlong) file->checksum(), TRUE);
+ table->field[18]->set_notnull();
}
}
+
+ tmp_buff= (share->table_charset ?
+ share->table_charset->name : "default");
+ table->field[17]->store(tmp_buff, strlen(tmp_buff), cs);
}
DBUG_RETURN(schema_table_store_record(thd, table));
}
@@ -3026,17 +3505,15 @@ static int get_schema_tables_record(THD
static int get_schema_column_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
LEX *lex= thd->lex;
const char *wild= lex->wild ? lex->wild->ptr() : NullS;
CHARSET_INFO *cs= system_charset_info;
TABLE *show_table;
- handler *file;
Field **ptr,*field;
int count;
- uint base_name_length, file_name_length;
DBUG_ENTER("get_schema_column_record");
if (res)
@@ -3056,15 +3533,11 @@ static int get_schema_column_record(THD
}
show_table= tables->table;
- file= show_table->file;
count= 0;
- file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
restore_record(show_table, s->default_values);
- base_name_length= strlen(base_name);
- file_name_length= strlen(file_name);
show_table->use_all_columns(); // Required for default
- for (ptr=show_table->field; (field= *ptr) ; ptr++)
+ for (ptr= show_table->field; (field= *ptr) ; ptr++)
{
const char *tmp_buff;
byte *pos;
@@ -3087,10 +3560,10 @@ static int get_schema_column_record(THD
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint col_access;
- check_access(thd,SELECT_ACL | EXTRA_ACL, base_name,
+ check_access(thd,SELECT_ACL | EXTRA_ACL, db_name->str,
&tables->grant.privilege, 0, 0, test(tables->schema_table));
col_access= get_column_grant(thd, &tables->grant,
- base_name, file_name,
+ db_name->str, table_name->str,
field->field_name) & COL_ACLS;
if (lex->sql_command != SQLCOM_SHOW_FIELDS &&
!tables->schema_table && !col_access)
@@ -3107,8 +3580,8 @@ static int get_schema_column_record(THD
table->field[17]->store(tmp+1,end == tmp ? 0 : (uint) (end-tmp-1), cs);
#endif
- table->field[1]->store(base_name, base_name_length, cs);
- table->field[2]->store(file_name, file_name_length, cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[2]->store(table_name->str, table_name->length, cs);
table->field[3]->store(field->field_name, strlen(field->field_name),
cs);
table->field[4]->store((longlong) count, TRUE);
@@ -3521,8 +3994,8 @@ err:
static int get_schema_stat_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_stat_record");
@@ -3545,10 +4018,11 @@ static int get_schema_stat_record(THD *t
else if (!tables->view)
{
TABLE *show_table= tables->table;
- KEY *key_info=show_table->key_info;
- show_table->file->info(HA_STATUS_VARIABLE |
- HA_STATUS_NO_LOCK |
- HA_STATUS_TIME);
+ KEY *key_info=show_table->s->key_info;
+ if (show_table->file)
+ 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++)
{
KEY_PART_INFO *key_part= key_info->key_part;
@@ -3556,35 +4030,40 @@ static int get_schema_stat_record(THD *t
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[2]->store(table_name->str, table_name->length, cs);
table->field[3]->store((longlong) ((key_info->flags &
HA_NOSAME) ? 0 : 1), TRUE);
- table->field[4]->store(base_name, strlen(base_name), cs);
+ table->field[4]->store(db_name->str, db_name->length, cs);
table->field[5]->store(key_info->name, strlen(key_info->name), cs);
table->field[6]->store((longlong) (j+1), TRUE);
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
table->field[7]->store(str, strlen(str), cs);
- if (show_table->file->index_flags(i, j, 0) & HA_READ_ORDER)
+ if (show_table->file)
{
- table->field[8]->store(((key_part->key_part_flag &
- HA_REVERSE_SORT) ?
- "D" : "A"), 1, cs);
- table->field[8]->set_notnull();
- }
- KEY *key=show_table->key_info+i;
- if (key->rec_per_key[j])
- {
- ha_rows records=(show_table->file->stats.records /
- key->rec_per_key[j]);
- table->field[9]->store((longlong) records, TRUE);
- table->field[9]->set_notnull();
+ if (show_table->file->index_flags(i, j, 0) & HA_READ_ORDER)
+ {
+ table->field[8]->store(((key_part->key_part_flag &
+ HA_REVERSE_SORT) ?
+ "D" : "A"), 1, cs);
+ table->field[8]->set_notnull();
+ }
+ KEY *key=show_table->key_info+i;
+ if (key->rec_per_key[j])
+ {
+ ha_rows records=(show_table->file->stats.records /
+ key->rec_per_key[j]);
+ table->field[9]->store((longlong) records, TRUE);
+ table->field[9]->set_notnull();
+ }
+ str= show_table->file->index_type(i);
+ table->field[13]->store(str, strlen(str), cs);
}
if (!(key_info->flags & HA_FULLTEXT) &&
(key_part->field &&
key_part->length !=
- show_table->field[key_part->fieldnr-1]->key_length()))
+ show_table->s->field[key_part->fieldnr-1]->key_length()))
{
table->field[10]->store((longlong) key_part->length /
key_part->field->charset()->mbmaxlen, TRUE);
@@ -3593,8 +4072,6 @@ static int get_schema_stat_record(THD *t
uint flags= key_part->field ? key_part->field->flags : 0;
const char *pos=(char*) ((flags & NOT_NULL_FLAG) ? "" : "YES");
table->field[12]->store(pos, strlen(pos), cs);
- pos= show_table->file->index_type(i);
- table->field[13]->store(pos, strlen(pos), cs);
if (!show_table->s->keys_in_use.is_set(i))
table->field[14]->store(STRING_WITH_LEN("disabled"), cs);
else
@@ -3611,8 +4088,8 @@ static int get_schema_stat_record(THD *t
static int get_schema_views_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_schema_views_record");
@@ -3678,16 +4155,16 @@ static int get_schema_views_record(THD *
}
-bool store_constraints(THD *thd, TABLE *table, const char *db,
- const char *tname, const char *key_name,
+bool store_constraints(THD *thd, TABLE *table, LEX_STRING *db_name,
+ LEX_STRING *table_name, const char *key_name,
uint key_len, const char *con_type, uint con_len)
{
CHARSET_INFO *cs= system_charset_info;
restore_record(table, s->default_values);
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
table->field[2]->store(key_name, key_len, cs);
- table->field[3]->store(db, strlen(db), cs);
- table->field[4]->store(tname, strlen(tname), cs);
+ table->field[3]->store(db_name->str, db_name->length, cs);
+ table->field[4]->store(table_name->str, table_name->length, cs);
table->field[5]->store(con_type, con_len, cs);
return schema_table_store_record(thd, table);
}
@@ -3695,13 +4172,13 @@ bool store_constraints(THD *thd, TABLE *
static int get_schema_constraints_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
DBUG_ENTER("get_schema_constraints_record");
if (res)
{
- if (!tables->view)
+ if (!tables->view && thd->net.last_errno)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
thd->clear_error();
@@ -3723,14 +4200,14 @@ static int get_schema_constraints_record
if (i == primary_key && !strcmp(key_info->name, primary_key_name))
{
- if (store_constraints(thd, table, base_name, file_name, key_info->name,
+ if (store_constraints(thd, table, db_name, table_name, key_info->name,
strlen(key_info->name),
STRING_WITH_LEN("PRIMARY KEY")))
DBUG_RETURN(1);
}
else if (key_info->flags & HA_NOSAME)
{
- if (store_constraints(thd, table, base_name, file_name, key_info->name,
+ if (store_constraints(thd, table, db_name, table_name, key_info->name,
strlen(key_info->name),
STRING_WITH_LEN("UNIQUE")))
DBUG_RETURN(1);
@@ -3742,7 +4219,7 @@ static int get_schema_constraints_record
List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
while ((f_key_info=it++))
{
- if (store_constraints(thd, table, base_name, file_name,
+ if (store_constraints(thd, table, db_name, table_name,
f_key_info->forein_id->str,
strlen(f_key_info->forein_id->str),
"FOREIGN KEY", 11))
@@ -3753,8 +4230,8 @@ static int get_schema_constraints_record
}
-static bool store_trigger(THD *thd, TABLE *table, const char *db,
- const char *tname, LEX_STRING *trigger_name,
+static bool store_trigger(THD *thd, TABLE *table, LEX_STRING *db_name,
+ LEX_STRING *table_name, LEX_STRING *trigger_name,
enum trg_event_type event,
enum trg_action_time_type timing,
LEX_STRING *trigger_stmt,
@@ -3766,12 +4243,12 @@ static bool store_trigger(THD *thd, TABL
ulong sql_mode_len;
restore_record(table, s->default_values);
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
table->field[2]->store(trigger_name->str, trigger_name->length, cs);
table->field[3]->store(trg_event_type_names[event].str,
trg_event_type_names[event].length, cs);
- table->field[5]->store(db, strlen(db), cs);
- table->field[6]->store(tname, strlen(tname), cs);
+ table->field[5]->store(db_name->str, db_name->length, cs);
+ table->field[6]->store(table_name->str, table_name->length, cs);
table->field[9]->store(trigger_stmt->str, trigger_stmt->length, cs);
table->field[10]->store(STRING_WITH_LEN("ROW"), cs);
table->field[11]->store(trg_action_time_type_names[timing].str,
@@ -3791,8 +4268,8 @@ static bool store_trigger(THD *thd, TABL
static int get_schema_triggers_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
DBUG_ENTER("get_schema_triggers_record");
/*
@@ -3828,7 +4305,7 @@ static int get_schema_triggers_record(TH
&definer_buffer))
continue;
- if (store_trigger(thd, table, base_name, file_name, &trigger_name,
+ if (store_trigger(thd, table, db_name, table_name, &trigger_name,
(enum trg_event_type) event,
(enum trg_action_time_type) timing, &trigger_stmt,
sql_mode,
@@ -3841,15 +4318,16 @@ static int get_schema_triggers_record(TH
}
-void store_key_column_usage(TABLE *table, const char*db, const char *tname,
- const char *key_name, uint key_len,
- const char *con_type, uint con_len, longlong idx)
+void store_key_column_usage(TABLE *table, LEX_STRING *db_name,
+ LEX_STRING *table_name, const char *key_name,
+ uint key_len, const char *con_type, uint con_len,
+ longlong idx)
{
CHARSET_INFO *cs= system_charset_info;
- table->field[1]->store(db, strlen(db), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
table->field[2]->store(key_name, key_len, cs);
- table->field[4]->store(db, strlen(db), cs);
- table->field[5]->store(tname, strlen(tname), cs);
+ table->field[4]->store(db_name->str, db_name->length, cs);
+ table->field[5]->store(table_name->str, table_name->length, cs);
table->field[6]->store(con_type, con_len, cs);
table->field[7]->store((longlong) idx, TRUE);
}
@@ -3858,13 +4336,13 @@ void store_key_column_usage(TABLE *table
static int get_schema_key_column_usage_record(THD *thd,
struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
DBUG_ENTER("get_schema_key_column_usage_record");
if (res)
{
- if (!tables->view)
+ if (!tables->view && thd->net.last_errno)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
thd->clear_error();
@@ -3891,7 +4369,7 @@ static int get_schema_key_column_usage_r
{
f_idx++;
restore_record(table, s->default_values);
- store_key_column_usage(table, base_name, file_name,
+ store_key_column_usage(table, db_name, table_name,
key_info->name,
strlen(key_info->name),
key_part->field->field_name,
@@ -3918,7 +4396,7 @@ static int get_schema_key_column_usage_r
r_info= it1++;
f_idx++;
restore_record(table, s->default_values);
- store_key_column_usage(table, base_name, file_name,
+ store_key_column_usage(table, db_name, table_name,
f_key_info->forein_id->str,
f_key_info->forein_id->length,
f_info->str, f_info->length,
@@ -4040,8 +4518,8 @@ static void store_schema_partitions_reco
static int get_schema_partitions_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name,
- const char *file_name)
+ LEX_STRING *db_name,
+ LEX_STRING *table_name)
{
CHARSET_INFO *cs= system_charset_info;
char buff[61];
@@ -4056,7 +4534,7 @@ static int get_schema_partitions_record(
if (res)
{
- if (!tables->view)
+ if (!tables->view && thd->net.last_errno)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
thd->clear_error();
@@ -4072,8 +4550,8 @@ static int get_schema_partitions_record(
uint part_pos= 0, part_id= 0;
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[2]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[2]->store(table_name->str, table_name->length, cs);
/* Partition method*/
@@ -4517,7 +4995,7 @@ int fill_status(THD *thd, TABLE_LIST *ta
static int
get_referential_constraints_record(THD *thd, struct st_table_list *tables,
TABLE *table, bool res,
- const char *base_name, const char *file_name)
+ LEX_STRING *db_name, LEX_STRING *table_name)
{
CHARSET_INFO *cs= system_charset_info;
DBUG_ENTER("get_referential_constraints_record");
@@ -4544,8 +5022,8 @@ get_referential_constraints_record(THD *
while ((f_key_info= it++))
{
restore_record(table, s->default_values);
- table->field[1]->store(base_name, strlen(base_name), cs);
- table->field[9]->store(file_name, strlen(file_name), cs);
+ table->field[1]->store(db_name->str, db_name->length, cs);
+ table->field[9]->store(table_name->str, table_name->length, cs);
table->field[2]->store(f_key_info->forein_id->str,
f_key_info->forein_id->length, cs);
table->field[4]->store(f_key_info->referenced_db->str,
@@ -4615,7 +5093,7 @@ static my_bool find_schema_table_in_plug
RETURN
0 table not found
- # pointer to 'shema_tables' element
+ # pointer to 'schema_tables' element
*/
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name)
@@ -4731,6 +5209,11 @@ TABLE *create_schema_table(THD *thd, TAB
TMP_TABLE_ALL_COLUMNS),
HA_POS_ERROR, table_list->alias)))
DBUG_RETURN(0);
+ byte *bitmaps= thd->alloc(bitmap_buffer_size(field_count));
+ bitmap_init(&table->def_read_set, (my_bitmap_map*) bitmaps, field_count,
+ FALSE);
+ table->read_set= &table->def_read_set;
+ bitmap_clear_all(table->read_set);
table_list->schema_table_param= tmp_table_param;
DBUG_RETURN(table);
}
@@ -5322,442 +5805,462 @@ int fill_schema_session_variables(THD *t
ST_FIELD_INFO schema_fields_info[]=
{
- {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"SCHEMA_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database"},
- {"DEFAULT_CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
- {"DEFAULT_COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
- {"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"CATALOG_NAME", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"SCHEMA_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database", SKIP_OPEN},
+ {"DEFAULT_CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"DEFAULT_COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"SQL_PATH", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO tables_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
- {"TABLE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Engine"},
- {"VERSION", 21 , MYSQL_TYPE_LONG, 0, 1, "Version"},
- {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format"},
- {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 1, "Rows"},
- {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Avg_row_length"},
- {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_length"},
- {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Max_data_length"},
- {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Index_length"},
- {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_free"},
- {"AUTO_INCREMENT", 21 , MYSQL_TYPE_LONG, 0, 1, "Auto_increment"},
- {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Create_time"},
- {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Update_time"},
- {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Check_time"},
- {"TABLE_COLLATION", 64, MYSQL_TYPE_STRING, 0, 1, "Collation"},
- {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, "Checksum"},
- {"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options"},
- {"TABLE_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", SKIP_OPEN},
+ {"TABLE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Engine", OPEN_FRM_ONLY},
+ {"VERSION", 21 , MYSQL_TYPE_LONG, 0, 1, "Version", OPEN_FRM_ONLY},
+ {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", OPEN_FULL_TABLE},
+ {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 1, "Rows", OPEN_FULL_TABLE},
+ {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Avg_row_length",
+ OPEN_FULL_TABLE},
+ {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_length", OPEN_FULL_TABLE},
+ {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Max_data_length",
+ OPEN_FULL_TABLE},
+ {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Index_length", OPEN_FULL_TABLE},
+ {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_free", OPEN_FULL_TABLE},
+ {"AUTO_INCREMENT", 21 , MYSQL_TYPE_LONG, 0, 1, "Auto_increment",
+ OPEN_FULL_TABLE},
+ {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Create_time", OPEN_FULL_TABLE},
+ {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Update_time", OPEN_FULL_TABLE},
+ {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Check_time", OPEN_FULL_TABLE},
+ {"TABLE_COLLATION", 64, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
+ {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, "Checksum", OPEN_FULL_TABLE},
+ {"CREATE_OPTIONS", 255, MYSQL_TYPE_STRING, 0, 1, "Create_options",
+ OPEN_FRM_ONLY},
+ {"TABLE_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO columns_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Field"},
- {"ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1, "Default"},
- {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null"},
- {"DATA_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0},
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, "Collation"},
- {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type"},
- {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key"},
- {"EXTRA", 20, MYSQL_TYPE_STRING, 0, 0, "Extra"},
- {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges"},
- {"COLUMN_COMMENT", 255, MYSQL_TYPE_STRING, 0, 0, "Comment"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Field", OPEN_FRM_ONLY},
+ {"ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FRM_ONLY},
+ {"COLUMN_DEFAULT", MAX_FIELD_VARCHARLENGTH, MYSQL_TYPE_STRING, 0, 1, "Default",
+ OPEN_FRM_ONLY},
+ {"IS_NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY},
+ {"DATA_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"CHARACTER_MAXIMUM_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FRM_ONLY},
+ {"CHARACTER_OCTET_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FRM_ONLY},
+ {"NUMERIC_PRECISION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FRM_ONLY},
+ {"NUMERIC_SCALE", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FRM_ONLY},
+ {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
+ {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
+ {"COLUMN_TYPE", 65535, MYSQL_TYPE_STRING, 0, 0, "Type", OPEN_FRM_ONLY},
+ {"COLUMN_KEY", 3, MYSQL_TYPE_STRING, 0, 0, "Key", OPEN_FRM_ONLY},
+ {"EXTRA", 20, MYSQL_TYPE_STRING, 0, 0, "Extra", OPEN_FRM_ONLY},
+ {"PRIVILEGES", 80, MYSQL_TYPE_STRING, 0, 0, "Privileges", OPEN_FRM_ONLY},
+ {"COLUMN_COMMENT", 255, MYSQL_TYPE_STRING, 0, 0, "Comment", OPEN_FRM_ONLY},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO charsets_fields_info[]=
{
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset"},
- {"DEFAULT_COLLATE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Default collation"},
- {"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description"},
- {"MAXLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Maxlen"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset", SKIP_OPEN},
+ {"DEFAULT_COLLATE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Default collation",
+ SKIP_OPEN},
+ {"DESCRIPTION", 60, MYSQL_TYPE_STRING, 0, 0, "Description", SKIP_OPEN},
+ {"MAXLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Maxlen", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO collation_fields_info[]=
{
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Collation"},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset"},
- {"ID", 11, MYSQL_TYPE_LONG, 0, 0, "Id"},
- {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, 0, "Default"},
- {"IS_COMPILED", 3, MYSQL_TYPE_STRING, 0, 0, "Compiled"},
- {"SORTLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Sortlen"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Collation", SKIP_OPEN},
+ {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Charset", SKIP_OPEN},
+ {"ID", 11, MYSQL_TYPE_LONG, 0, 0, "Id", SKIP_OPEN},
+ {"IS_DEFAULT", 3, MYSQL_TYPE_STRING, 0, 0, "Default", SKIP_OPEN},
+ {"IS_COMPILED", 3, MYSQL_TYPE_STRING, 0, 0, "Compiled", SKIP_OPEN},
+ {"SORTLEN", 3 ,MYSQL_TYPE_LONG, 0, 0, "Sortlen", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO engines_fields_info[]=
{
- {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine"},
- {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support"},
- {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment"},
- {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 0, "Transactions"},
- {"XA", 3, MYSQL_TYPE_STRING, 0, 0, "XA"},
- {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 0, "Savepoints"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"ENGINE", 64, MYSQL_TYPE_STRING, 0, 0, "Engine", SKIP_OPEN},
+ {"SUPPORT", 8, MYSQL_TYPE_STRING, 0, 0, "Support", SKIP_OPEN},
+ {"COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN},
+ {"TRANSACTIONS", 3, MYSQL_TYPE_STRING, 0, 0, "Transactions", SKIP_OPEN},
+ {"XA", 3, MYSQL_TYPE_STRING, 0, 0, "XA", SKIP_OPEN},
+ {"SAVEPOINTS", 3 ,MYSQL_TYPE_STRING, 0, 0, "Savepoints", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO events_fields_info[]=
{
- {"EVENT_CATALOG", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"EVENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db"},
- {"EVENT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
- {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer"},
- {"EVENT_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0},
- {"EVENT_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
- {"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"},
- {"EXECUTE_AT", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Execute at"},
- {"INTERVAL_VALUE", 256, MYSQL_TYPE_STRING, 0, 1, "Interval value"},
- {"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field"},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
- {"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts"},
- {"ENDS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Ends"},
- {"STATUS", 8, MYSQL_TYPE_STRING, 0, 0, "Status"},
- {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0},
- {"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0},
- {"LAST_EXECUTED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"EVENT_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"EVENT_CATALOG", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"EVENT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db", SKIP_OPEN},
+ {"EVENT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", SKIP_OPEN},
+ {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN},
+ {"EVENT_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"EVENT_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"EVENT_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN},
+ {"EXECUTE_AT", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Execute at", SKIP_OPEN},
+ {"INTERVAL_VALUE", 256, MYSQL_TYPE_STRING, 0, 1, "Interval value", SKIP_OPEN},
+ {"INTERVAL_FIELD", 18, MYSQL_TYPE_STRING, 0, 1, "Interval field", SKIP_OPEN},
+ {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts", SKIP_OPEN},
+ {"ENDS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Ends", SKIP_OPEN},
+ {"STATUS", 8, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN},
+ {"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0, SKIP_OPEN},
+ {"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0, SKIP_OPEN},
+ {"LAST_EXECUTED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, SKIP_OPEN},
+ {"EVENT_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO coll_charset_app_fields_info[]=
{
- {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"COLLATION_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"CHARACTER_SET_NAME", 64, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO proc_fields_info[]=
{
- {"SPECIFIC_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ROUTINE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"ROUTINE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db"},
- {"ROUTINE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
- {"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type"},
- {"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"EXTERNAL_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"EXTERNAL_LANGUAGE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {"SQL_DATA_ACCESS", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"SQL_PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, "Security_type"},
- {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, "Created"},
- {"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, "Modified"},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ROUTINE_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment"},
- {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"SPECIFIC_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"ROUTINE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"ROUTINE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Db", SKIP_OPEN},
+ {"ROUTINE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", SKIP_OPEN},
+ {"ROUTINE_TYPE", 9, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN},
+ {"DTD_IDENTIFIER", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"ROUTINE_BODY", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"ROUTINE_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"EXTERNAL_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"EXTERNAL_LANGUAGE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"PARAMETER_STYLE", 8, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"IS_DETERMINISTIC", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"SQL_DATA_ACCESS", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"SQL_PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, "Security_type", SKIP_OPEN},
+ {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, "Created", SKIP_OPEN},
+ {"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, "Modified", SKIP_OPEN},
+ {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"ROUTINE_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Comment", SKIP_OPEN},
+ {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, "Definer", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO stat_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table"},
- {"NON_UNIQUE", 1, MYSQL_TYPE_LONG, 0, 0, "Non_unique"},
- {"INDEX_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Key_name"},
- {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONG, 0, 0, "Seq_in_index"},
- {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name"},
- {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation"},
- {"CARDINALITY", 21, MYSQL_TYPE_LONG, 0, 1, "Cardinality"},
- {"SUB_PART", 3, MYSQL_TYPE_LONG, 0, 1, "Sub_part"},
- {"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed"},
- {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null"},
- {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type"},
- {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FRM_ONLY},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", OPEN_FRM_ONLY},
+ {"NON_UNIQUE", 1, MYSQL_TYPE_LONG, 0, 0, "Non_unique", OPEN_FRM_ONLY},
+ {"INDEX_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FRM_ONLY},
+ {"INDEX_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Key_name", OPEN_FRM_ONLY},
+ {"SEQ_IN_INDEX", 2, MYSQL_TYPE_LONG, 0, 0, "Seq_in_index", OPEN_FRM_ONLY},
+ {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Column_name",
+ OPEN_FRM_ONLY},
+ {"COLLATION", 1, MYSQL_TYPE_STRING, 0, 1, "Collation", OPEN_FRM_ONLY},
+ {"CARDINALITY", 21, MYSQL_TYPE_LONG, 0, 1, "Cardinality", OPEN_FULL_TABLE},
+ {"SUB_PART", 3, MYSQL_TYPE_LONG, 0, 1, "Sub_part", OPEN_FRM_ONLY},
+ {"PACKED", 10, MYSQL_TYPE_STRING, 0, 1, "Packed", OPEN_FRM_ONLY},
+ {"NULLABLE", 3, MYSQL_TYPE_STRING, 0, 0, "Null", OPEN_FRM_ONLY},
+ {"INDEX_TYPE", 16, MYSQL_TYPE_STRING, 0, 0, "Index_type",
+ OPEN_FULL_TABLE},
+ {"COMMENT", 16, MYSQL_TYPE_STRING, 0, 1, "Comment", OPEN_FRM_ONLY},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO view_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, 0},
- {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"VIEW_DEFINITION", 65535, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CHECK_OPTION", 8, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"IS_UPDATABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"DEFINER", 77, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"SECURITY_TYPE", 7, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO user_privileges_fields_info[]=
{
- {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO schema_privileges_fields_info[]=
{
- {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO table_privileges_fields_info[]=
{
- {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO column_privileges_fields_info[]=
{
- {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"GRANTEE", 81, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"PRIVILEGE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"IS_GRANTABLE", 3, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO table_constraints_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CONSTRAINT_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO key_column_usage_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONG, 0, 0, 0},
- {"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONG, 0, 1, 0},
- {"REFERENCED_TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"REFERENCED_COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONG, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"REFERENCED_TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"REFERENCED_COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO table_names_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Tables_in_"},
- {"TABLE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_type"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Tables_in_", SKIP_OPEN},
+ {"TABLE_TYPE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table_type", OPEN_FRM_ONLY},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO open_tables_fields_info[]=
{
- {"Database", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database"},
- {"Table",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table"},
- {"In_use", 1, MYSQL_TYPE_LONG, 0, 0, "In_use"},
- {"Name_locked", 4, MYSQL_TYPE_LONG, 0, 0, "Name_locked"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"Database", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Database", SKIP_OPEN},
+ {"Table",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table", SKIP_OPEN},
+ {"In_use", 1, MYSQL_TYPE_LONG, 0, 0, "In_use", SKIP_OPEN},
+ {"Name_locked", 4, MYSQL_TYPE_LONG, 0, 0, "Name_locked", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO triggers_fields_info[]=
{
- {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TRIGGER_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TRIGGER_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Trigger"},
- {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event"},
- {"EVENT_OBJECT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"EVENT_OBJECT_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"EVENT_OBJECT_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table"},
- {"ACTION_ORDER", 4, MYSQL_TYPE_LONG, 0, 0, 0},
- {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"ACTION_STATEMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Statement"},
- {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing"},
- {"ACTION_REFERENCE_OLD_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"ACTION_REFERENCE_NEW_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Created"},
- {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode"},
- {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TRIGGER_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"TRIGGER_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TRIGGER_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Trigger",
+ OPEN_FULL_TABLE},
+ {"EVENT_MANIPULATION", 6, MYSQL_TYPE_STRING, 0, 0, "Event", OPEN_FULL_TABLE},
+ {"EVENT_OBJECT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"EVENT_OBJECT_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"EVENT_OBJECT_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Table",
+ OPEN_FULL_TABLE},
+ {"ACTION_ORDER", 4, MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"ACTION_CONDITION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"ACTION_STATEMENT", 65535, MYSQL_TYPE_STRING, 0, 0, "Statement",
+ OPEN_FULL_TABLE},
+ {"ACTION_ORIENTATION", 9, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"ACTION_TIMING", 6, MYSQL_TYPE_STRING, 0, 0, "Timing", OPEN_FULL_TABLE},
+ {"ACTION_REFERENCE_OLD_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"ACTION_REFERENCE_NEW_TABLE", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"ACTION_REFERENCE_OLD_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"ACTION_REFERENCE_NEW_ROW", 3, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Created", OPEN_FULL_TABLE},
+ {"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, "sql_mode", OPEN_FULL_TABLE},
+ {"DEFINER", 65535, MYSQL_TYPE_STRING, 0, 0, "Definer", OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO partitions_fields_info[]=
{
- {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PARTITION_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"SUBPARTITION_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"SUBPARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"PARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0},
- {"SUBPARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"SUBPARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PARTITION_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 0, 0},
- {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0},
- {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0},
- {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"TABLE_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"TABLE_SCHEMA",NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"PARTITION_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"SUBPARTITION_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"PARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
+ {"SUBPARTITION_ORDINAL_POSITION", 21 , MYSQL_TYPE_LONG, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"PARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"SUBPARTITION_METHOD", 12, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"PARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"SUBPARTITION_EXPRESSION", 65535, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"PARTITION_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
+ {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, OPEN_FULL_TABLE},
+ {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, OPEN_FULL_TABLE},
+ {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, OPEN_FULL_TABLE},
+ {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, 0, OPEN_FULL_TABLE},
+ {"PARTITION_COMMENT", 80, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"NODEGROUP", 12 , MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO variables_fields_info[]=
{
- {"Variable_name", 80, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
- {"Value", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, "Value"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"Variable_name", 80, MYSQL_TYPE_STRING, 0, 0, "Variable_name", SKIP_OPEN},
+ {"Value", FN_REFLEN, MYSQL_TYPE_STRING, 0, 0, "Value", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO status_fields_info[]=
{
- {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
- {"VARIABLE_VALUE", 2207, MYSQL_TYPE_DECIMAL, 0, 0, "Value"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", SKIP_OPEN},
+ {"VARIABLE_VALUE", 2207, MYSQL_TYPE_DECIMAL, 0, 0, "Value", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO system_variables_fields_info[]=
{
- {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name"},
- {"VARIABLE_VALUE", 65535, MYSQL_TYPE_STRING, 0, 1, "Value"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"VARIABLE_NAME", 64, MYSQL_TYPE_STRING, 0, 0, "Variable_name", SKIP_OPEN},
+ {"VARIABLE_VALUE", 65535, MYSQL_TYPE_STRING, 0, 1, "Value", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO processlist_fields_info[]=
{
- {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id"},
- {"USER", 16, MYSQL_TYPE_STRING, 0, 0, "User"},
- {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host"},
- {"DB", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Db"},
- {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command"},
- {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time"},
- {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State"},
- {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"ID", 4, MYSQL_TYPE_LONG, 0, 0, "Id", SKIP_OPEN},
+ {"USER", 16, MYSQL_TYPE_STRING, 0, 0, "User", SKIP_OPEN},
+ {"HOST", LIST_PROCESS_HOST_LEN, MYSQL_TYPE_STRING, 0, 0, "Host", SKIP_OPEN},
+ {"DB", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Db", SKIP_OPEN},
+ {"COMMAND", 16, MYSQL_TYPE_STRING, 0, 0, "Command", SKIP_OPEN},
+ {"TIME", 7, MYSQL_TYPE_LONG, 0, 0, "Time", SKIP_OPEN},
+ {"STATE", 64, MYSQL_TYPE_STRING, 0, 1, "State", SKIP_OPEN},
+ {"INFO", PROCESS_LIST_INFO_WIDTH, MYSQL_TYPE_STRING, 0, 1, "Info", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO plugin_fields_info[]=
{
- {"PLUGIN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name"},
- {"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status"},
- {"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type"},
- {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0},
- {"PLUGIN_LIBRARY", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Library"},
- {"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PLUGIN_AUTHOR", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0},
- {"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 1, "License"},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"PLUGIN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, "Name", SKIP_OPEN},
+ {"PLUGIN_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"PLUGIN_STATUS", 10, MYSQL_TYPE_STRING, 0, 0, "Status", SKIP_OPEN},
+ {"PLUGIN_TYPE", 80, MYSQL_TYPE_STRING, 0, 0, "Type", SKIP_OPEN},
+ {"PLUGIN_TYPE_VERSION", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"PLUGIN_LIBRARY", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, "Library", SKIP_OPEN},
+ {"PLUGIN_LIBRARY_VERSION", 20, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"PLUGIN_AUTHOR", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"PLUGIN_DESCRIPTION", 65535, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"PLUGIN_LICENSE", 80, MYSQL_TYPE_STRING, 0, 1, "License", SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
ST_FIELD_INFO files_fields_info[]=
{
- {"FILE_ID", 4, MYSQL_TYPE_LONG, 0, 0, 0},
- {"FILE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"FILE_TYPE", 20, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_CATALOG", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"LOGFILE_GROUP_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"LOGFILE_GROUP_NUMBER", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"FULLTEXT_KEYS", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"DELETED_ROWS", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"UPDATE_COUNT", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"FREE_EXTENTS", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"TOTAL_EXTENTS", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"EXTENT_SIZE", 4, MYSQL_TYPE_LONG, 0, 0, 0},
- {"INITIAL_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0},
- {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0},
- {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0},
- {"CREATION_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"LAST_UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"LAST_ACCESS_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
- {"RECOVER_TIME", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"TRANSACTION_COUNTER", 4, MYSQL_TYPE_LONG, 0, 1, 0},
- {"VERSION", 21 , MYSQL_TYPE_LONG, 0, 1, "Version"},
- {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format"},
- {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 1, "Rows"},
- {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Avg_row_length"},
- {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_length"},
- {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Max_data_length"},
- {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Index_length"},
- {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_free"},
- {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Create_time"},
- {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Update_time"},
- {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Check_time"},
- {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, "Checksum"},
- {"STATUS", 20, MYSQL_TYPE_STRING, 0, 0, 0},
- {"EXTRA", 255, MYSQL_TYPE_STRING, 0, 1, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"FILE_ID", 4, MYSQL_TYPE_LONG, 0, 0, 0, SKIP_OPEN},
+ {"FILE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"FILE_TYPE", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"TABLESPACE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_CATALOG", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"LOGFILE_GROUP_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"LOGFILE_GROUP_NUMBER", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"FULLTEXT_KEYS", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {"DELETED_ROWS", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"UPDATE_COUNT", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"FREE_EXTENTS", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"TOTAL_EXTENTS", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"EXTENT_SIZE", 4, MYSQL_TYPE_LONG, 0, 0, 0, SKIP_OPEN},
+ {"INITIAL_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"MAXIMUM_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"AUTOEXTEND_SIZE", 21, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"CREATION_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, SKIP_OPEN},
+ {"LAST_UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, SKIP_OPEN},
+ {"LAST_ACCESS_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0, SKIP_OPEN},
+ {"RECOVER_TIME", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"TRANSACTION_COUNTER", 4, MYSQL_TYPE_LONG, 0, 1, 0, SKIP_OPEN},
+ {"VERSION", 21 , MYSQL_TYPE_LONG, 0, 1, "Version", SKIP_OPEN},
+ {"ROW_FORMAT", 10, MYSQL_TYPE_STRING, 0, 1, "Row_format", SKIP_OPEN},
+ {"TABLE_ROWS", 21 , MYSQL_TYPE_LONG, 0, 1, "Rows", SKIP_OPEN},
+ {"AVG_ROW_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Avg_row_length", SKIP_OPEN},
+ {"DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_length", SKIP_OPEN},
+ {"MAX_DATA_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Max_data_length", SKIP_OPEN},
+ {"INDEX_LENGTH", 21 , MYSQL_TYPE_LONG, 0, 1, "Index_length", SKIP_OPEN},
+ {"DATA_FREE", 21 , MYSQL_TYPE_LONG, 0, 1, "Data_free", SKIP_OPEN},
+ {"CREATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Create_time", SKIP_OPEN},
+ {"UPDATE_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Update_time", SKIP_OPEN},
+ {"CHECK_TIME", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Check_time", SKIP_OPEN},
+ {"CHECKSUM", 21 , MYSQL_TYPE_LONG, 0, 1, "Checksum", SKIP_OPEN},
+ {"STATUS", 20, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN},
+ {"EXTRA", 255, MYSQL_TYPE_STRING, 0, 1, 0, SKIP_OPEN},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
void init_fill_schema_files_row(TABLE* table)
@@ -5772,18 +6275,22 @@ void init_fill_schema_files_row(TABLE* t
ST_FIELD_INFO referential_constraints_fields_info[]=
{
- {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"UNIQUE_CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0},
- {"UNIQUE_CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"UNIQUE_CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"MATCH_OPTION", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"UPDATE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"DELETE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {"CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"UNIQUE_CONSTRAINT_CATALOG", FN_REFLEN, MYSQL_TYPE_STRING, 0, 1, 0,
+ OPEN_FULL_TABLE},
+ {"UNIQUE_CONSTRAINT_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
+ {"UNIQUE_CONSTRAINT_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
+ {"MATCH_OPTION", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"UPDATE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"DELETE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0, OPEN_FULL_TABLE},
+ {"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0,
+ OPEN_FULL_TABLE},
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN}
};
@@ -5797,69 +6304,86 @@ ST_FIELD_INFO referential_constraints_fi
ST_SCHEMA_TABLE schema_tables[]=
{
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
- fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0},
+ fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"COLLATIONS", collation_fields_info, create_schema_table,
- fill_schema_collation, make_old_format, 0, -1, -1, 0},
+ fill_schema_collation, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
- create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0},
+ create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"COLUMNS", columns_fields_info, create_schema_table,
- get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0},
+ get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0,
+ OPEN_VIEW_OR_TABLE},
{"COLUMN_PRIVILEGES", column_privileges_fields_info, create_schema_table,
- fill_schema_column_privileges, 0, 0, -1, -1, 0},
+ fill_schema_column_privileges, 0, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"ENGINES", engines_fields_info, create_schema_table,
- fill_schema_engines, make_old_format, 0, -1, -1, 0},
+ fill_schema_engines, make_old_format, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"EVENTS", events_fields_info, create_schema_table,
- Events::fill_schema_events, make_old_format, 0, -1, -1, 0},
+ Events::fill_schema_events, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"FILES", files_fields_info, create_schema_table,
- fill_schema_files, 0, 0, -1, -1, 0},
+ fill_schema_files, 0, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"GLOBAL_STATUS", status_fields_info, create_schema_table,
- fill_schema_global_status, make_old_format, 0, -1, -1, 0},
+ fill_schema_global_status, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"GLOBAL_VARIABLES", system_variables_fields_info, create_schema_table,
- fill_schema_global_variables, make_old_format, 0, -1, -1, 0},
+ fill_schema_global_variables, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"KEY_COLUMN_USAGE", key_column_usage_fields_info, create_schema_table,
- get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0},
+ get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0,
+ OPEN_TABLE_ONLY},
{"OPEN_TABLES", open_tables_fields_info, create_schema_table,
- fill_open_tables, make_old_format, 0, -1, -1, 1},
+ fill_open_tables, make_old_format, 0, -1, -1, 1, OPEN_VIEW_OR_TABLE},
{"PARTITIONS", partitions_fields_info, create_schema_table,
- get_all_tables, 0, get_schema_partitions_record, 1, 2, 0},
+ get_all_tables, 0, get_schema_partitions_record, 1, 2, 0,
+ OPEN_TABLE_ONLY},
{"PLUGINS", plugin_fields_info, create_schema_table,
- fill_plugins, make_old_format, 0, -1, -1, 0},
+ fill_plugins, make_old_format, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"PROCESSLIST", processlist_fields_info, create_schema_table,
- fill_schema_processlist, make_old_format, 0, -1, -1, 0},
+ fill_schema_processlist, make_old_format, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info,
create_schema_table, get_all_tables, 0, get_referential_constraints_record,
- 1, 9, 0},
+ 1, 9, 0, OPEN_TABLE_ONLY},
{"ROUTINES", proc_fields_info, create_schema_table,
- fill_schema_proc, make_proc_old_format, 0, -1, -1, 0},
+ fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"SCHEMATA", schema_fields_info, create_schema_table,
- fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0},
+ fill_schema_shemata, make_schemata_old_format, 0, 1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
- fill_schema_schema_privileges, 0, 0, -1, -1, 0},
+ fill_schema_schema_privileges, 0, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"SESSION_STATUS", status_fields_info, create_schema_table,
- fill_schema_session_status, make_old_format, 0, -1, -1, 0},
+ fill_schema_session_status, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"SESSION_VARIABLES", system_variables_fields_info, create_schema_table,
- fill_schema_session_variables, make_old_format, 0, -1, -1, 0},
+ fill_schema_session_variables, make_old_format, 0, -1, -1, 0,
+ OPEN_VIEW_OR_TABLE},
{"STATISTICS", stat_fields_info, create_schema_table,
- get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0},
+ get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
+ OPEN_TABLE_ONLY},
{"STATUS", variables_fields_info, create_schema_table, fill_status,
- make_old_format, 0, -1, -1, 1},
+ make_old_format, 0, -1, -1, 1, OPEN_VIEW_OR_TABLE},
{"TABLES", tables_fields_info, create_schema_table,
- get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0},
+ get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
+ OPEN_VIEW_OR_TABLE},
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
- get_all_tables, 0, get_schema_constraints_record, 3, 4, 0},
+ get_all_tables, 0, get_schema_constraints_record, 3, 4, 0,
+ OPEN_TABLE_ONLY},
{"TABLE_NAMES", table_names_fields_info, create_schema_table,
- get_all_tables, make_table_names_old_format, 0, 1, 2, 1},
+ get_all_tables, make_table_names_old_format, 0, 1, 2, 1,
+ OPEN_VIEW_OR_TABLE},
{"TABLE_PRIVILEGES", table_privileges_fields_info, create_schema_table,
- fill_schema_table_privileges, 0, 0, -1, -1, 0},
+ fill_schema_table_privileges, 0, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"TRIGGERS", triggers_fields_info, create_schema_table,
- get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0},
+ get_all_tables, make_old_format, get_schema_triggers_record, 5, 6, 0,
+ OPEN_TABLE_ONLY},
{"USER_PRIVILEGES", user_privileges_fields_info, create_schema_table,
- fill_schema_user_privileges, 0, 0, -1, -1, 0},
+ fill_schema_user_privileges, 0, 0, -1, -1, 0, OPEN_VIEW_OR_TABLE},
{"VARIABLES", variables_fields_info, create_schema_table, fill_variables,
- make_old_format, 0, -1, -1, 1},
+ make_old_format, 0, -1, -1, 1, OPEN_VIEW_OR_TABLE},
{"VIEWS", view_fields_info, create_schema_table,
- get_all_tables, 0, get_schema_views_record, 1, 2, 0},
- {0, 0, 0, 0, 0, 0, 0, 0, 0}
+ get_all_tables, 0, get_schema_views_record, 1, 2, 0, OPEN_VIEW_ONLY},
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, OPEN_VIEW_OR_TABLE}
};
@@ -5884,6 +6408,7 @@ int initialize_schema_table(st_plugin_in
schema_table->old_format= make_old_format;
schema_table->idx_field1= -1,
schema_table->idx_field2= -1;
+ schema_table->requested_object= OPEN_VIEW_OR_TABLE;
if (plugin->plugin->init(schema_table))
{
--- 1.275/sql/table.cc 2007-02-14 04:09:34 +04:00
+++ 1.276/sql/table.cc 2007-03-21 10:53:40 +04:00
@@ -327,7 +327,16 @@ int open_table_def(THD *thd, TABLE_SHARE
{
if (head[2] == FRM_VER || head[2] == FRM_VER+1 ||
(head[2] >= FRM_VER+3 && head[2] <= FRM_VER+4))
+ {
+ /* Open view only */
+ if (db_flags & SKIP_OPEN_TABLE)
+ {
+ error_given= 1;
+ goto err;
+ }
table_type= 1;
+
+ }
else
{
error= 6; // Unkown .frm version
@@ -1343,9 +1352,13 @@ int open_table_from_share(THD *thd, TABL
outparam->keys_in_use_for_query.init();
/* Allocate handler */
- if (!(outparam->file= get_new_handler(share, &outparam->mem_root,
- share->db_type)))
- goto err;
+ outparam->file= 0;
+ if (!(prgflag & OPEN_FRM_FILE_ONLY))
+ {
+ if (!(outparam->file= get_new_handler(share, &outparam->mem_root,
+ share->db_type)))
+ goto err;
+ }
error= 4;
outparam->reginfo.lock_type= TL_UNLOCK;
--- 1.161/sql/table.h 2007-02-13 12:30:02 +04:00
+++ 1.162/sql/table.h 2007-03-21 10:53:40 +04:00
@@ -530,6 +530,17 @@ enum enum_schema_tables
};
+#define SKIP_OPEN 0
+#define OPEN_FRM_ONLY 1
+#define OPEN_FULL_TABLE 2
+
+enum enum_schema_requested_object
+{
+ OPEN_VIEW_OR_TABLE,
+ OPEN_TABLE_ONLY,
+ OPEN_VIEW_ONLY
+};
+
typedef struct st_field_info
{
const char* field_name;
@@ -538,6 +549,7 @@ typedef struct st_field_info
int value;
bool maybe_null;
const char* old_name;
+ uint open_method;
} ST_FIELD_INFO;
@@ -554,11 +566,11 @@ typedef struct st_schema_table
int (*fill_table) (THD *thd, struct st_table_list *tables, COND *cond);
/* Handle fileds for old SHOW */
int (*old_format) (THD *thd, struct st_schema_table *schema_table);
- int (*process_table) (THD *thd, struct st_table_list *tables,
- TABLE *table, bool res, const char *base_name,
- const char *file_name);
+ int (*process_table) (THD *thd, struct st_table_list *tables, TABLE *table,
+ bool res, LEX_STRING *db_name, LEX_STRING *table_name);
int idx_field1, idx_field2;
bool hidden;
+ enum enum_schema_requested_object requested_object;
} ST_SCHEMA_TABLE;
@@ -845,6 +857,7 @@ typedef struct st_table_list
*/
bool prelocking_placeholder;
+ enum enum_schema_requested_object requested_object;
enum enum_schema_table_state schema_table_state;
void calc_md5(char *buffer);
void set_underlying_merge();
--- 1.51/sql/unireg.h 2006-12-31 04:06:37 +04:00
+++ 1.52/sql/unireg.h 2007-03-21 10:53:40 +04:00
@@ -152,6 +152,8 @@
#define OPEN_VIEW 8192 /* Allow open on view */
#define OPEN_VIEW_NO_PARSE 16384 /* Open frm only if it's a view,
but do not parse view itself */
+#define OPEN_FRM_FILE_ONLY 32768 /* Open frm file only */
+#define SKIP_OPEN_TABLE OPEN_FRM_FILE_ONLY*2 /* Open view only */
#define SC_INFO_LENGTH 4 /* Form format constant */
#define TE_INFO_LENGTH 3
#define MTYP_NOEMPTY_BIT 128
--- 1.4/sql/sql_show.h 2006-12-31 05:28:54 +04:00
+++ 1.5/sql/sql_show.h 2007-03-21 10:53:40 +04:00
@@ -30,7 +30,7 @@ enum find_files_result {
FIND_FILES_DIR
};
-find_files_result find_files(THD *thd, List<char> *files, const char *db,
+find_files_result find_files(THD *thd, List<LEX_STRING> *files, const char *db,
const char *path, const char *wild, bool dir);
int store_create_info(THD *thd, TABLE_LIST *table_list, String *packet,
--- 1.41/mysql-test/r/ndb_alter_table.result 2006-12-18 10:46:37 +04:00
+++ 1.42/mysql-test/r/ndb_alter_table.result 2007-03-21 10:53:39 +04:00
@@ -34,13 +34,13 @@ col5 enum('PENDING', 'ACTIVE', 'DISABLED
col6 int not null, to_be_deleted int) ENGINE=ndbcluster;
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
-t1 NDBCLUSTER 10 Dynamic 0 # # # 0 # 1 # # # latin1_swedish_ci NULL #
+t1 ndbcluster 10 Dynamic 0 # # # 0 # 1 # # # latin1_swedish_ci NULL #
SET SQL_MODE=NO_AUTO_VALUE_ON_ZERO;
insert into t1 values
(0,4,3,5,"PENDING",1,7),(NULL,4,3,5,"PENDING",1,7),(31,4,3,5,"PENDING",1,7),
(7,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7), (100,4,3,5,"PENDING",1,7),
(99,4,3,5,"PENDING",1,7), (8,4,3,5,"PENDING",1,7), (NULL,4,3,5,"PENDING",1,7);
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
-t1 NDBCLUSTER 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
+t1 ndbcluster 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col1 col2 col3 col4 col5 col6 to_be_deleted
0 4 3 5 PENDING 1 7
@@ -60,7 +60,7 @@ change column col2 fourth varchar(30) no
modify column col6 int not null first;
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
-t1 NDBCLUSTER 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
+t1 ndbcluster 10 Dynamic 9 # # # 0 # 102 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
@@ -75,7 +75,7 @@ col6 col1 col3 fourth col4 col4_5 col5 c
insert into t1 values (2, NULL,4,3,5,99,"PENDING","EXTRA",'2004-01-01 00:00:00');
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
-t1 NDBCLUSTER 10 Dynamic 10 # # # 0 # 103 # # # latin1_swedish_ci NULL #
+t1 ndbcluster 10 Dynamic 10 # # # 0 # 103 # # # latin1_swedish_ci NULL #
select * from t1 order by col1;
col6 col1 col3 fourth col4 col4_5 col5 col7 col8
1 0 3 4 5 PENDING 0000-00-00 00:00:00
--- 1.406/sql/ha_ndbcluster.cc 2007-02-12 23:58:16 +04:00
+++ 1.407/sql/ha_ndbcluster.cc 2007-03-21 10:53:39 +04:00
@@ -6486,7 +6486,7 @@ int ndbcluster_find_all_files(THD *thd)
int ndbcluster_find_files(handlerton *hton, THD *thd,
const char *db,
const char *path,
- const char *wild, bool dir, List<char> *files)
+ const char *wild, bool dir, List<LEX_STRING> *files)
{
DBUG_ENTER("ndbcluster_find_files");
DBUG_PRINT("enter", ("db: %s", db));
@@ -6553,21 +6553,22 @@ int ndbcluster_find_files(handlerton *ht
my_hash_insert(&ndb_tables, (byte*)thd->strdup(elmt.name));
}
- char *file_name;
- List_iterator<char> it(*files);
+ LEX_STRING *file_name;
+ List_iterator<LEX_STRING> it(*files);
List<char> delete_list;
+ char *file_name_str;
while ((file_name=it++))
{
bool file_on_disk= FALSE;
- DBUG_PRINT("info", ("%s", file_name));
- if (hash_search(&ndb_tables, file_name, strlen(file_name)))
+ DBUG_PRINT("info", ("%s", file_name->str));
+ if (hash_search(&ndb_tables, file_name->str, file_name->length))
{
- DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name));
+ DBUG_PRINT("info", ("%s existed in NDB _and_ on disk ", file_name->str));
file_on_disk= TRUE;
}
// Check for .ndb file with this name
- build_table_filename(name, sizeof(name), db, file_name, ha_ndb_ext, 0);
+ build_table_filename(name, sizeof(name), db, file_name->str, ha_ndb_ext, 0);
DBUG_PRINT("info", ("Check access for %s", name));
if (my_access(name, F_OK))
{
@@ -6576,31 +6577,32 @@ int ndbcluster_find_files(handlerton *ht
if (file_on_disk)
{
// Ignore this ndb table
- gptr record= hash_search(&ndb_tables, file_name, strlen(file_name));
+ gptr record= hash_search(&ndb_tables, file_name->str,
+ file_name->length);
DBUG_ASSERT(record);
hash_delete(&ndb_tables, record);
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TABLE_EXISTS_ERROR,
"Local table %s.%s shadows ndb table",
- db, file_name);
+ db, file_name->str);
}
continue;
}
if (file_on_disk)
{
// File existed in NDB and as frm file, put in ok_tables list
- my_hash_insert(&ok_tables, (byte*)file_name);
+ my_hash_insert(&ok_tables, (byte*)file_name->str);
continue;
}
DBUG_PRINT("info", ("%s existed on disk", name));
// The .ndb file exists on disk, but it's not in list of tables in ndb
// Verify that handler agrees table is gone.
- if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name) == 0)
+ if (ndbcluster_table_exists_in_engine(hton, thd, db, file_name->str) == 0)
{
- DBUG_PRINT("info", ("NDB says %s does not exists", file_name));
+ DBUG_PRINT("info", ("NDB says %s does not exists", file_name->str));
it.remove();
// Put in list of tables to remove from disk
- delete_list.push_back(thd->strdup(file_name));
+ delete_list.push_back(thd->strdup(file_name->str));
}
}
@@ -6611,12 +6613,12 @@ int ndbcluster_find_files(handlerton *ht
build_table_filename(name, sizeof(name), db, "", "", 0);
for (i= 0; i < ok_tables.records; i++)
{
- file_name= (char*)hash_element(&ok_tables, i);
+ file_name_str= (char*)hash_element(&ok_tables, i);
end= end1 +
- tablename_to_filename(file_name, end1, sizeof(name) - (end1 - name));
+ tablename_to_filename(file_name_str, end1, sizeof(name) - (end1 - name));
pthread_mutex_lock(&LOCK_open);
ndbcluster_create_binlog_setup(ndb, name, end-name,
- db, file_name, TRUE);
+ db, file_name_str, TRUE);
pthread_mutex_unlock(&LOCK_open);
}
}
@@ -6627,16 +6629,16 @@ int ndbcluster_find_files(handlerton *ht
List<char> create_list;
for (i= 0 ; i < ndb_tables.records ; i++)
{
- file_name= hash_element(&ndb_tables, i);
- if (!hash_search(&ok_tables, file_name, strlen(file_name)))
+ file_name_str= hash_element(&ndb_tables, i);
+ if (!hash_search(&ok_tables, file_name_str, strlen(file_name_str)))
{
- build_table_filename(name, sizeof(name), db, file_name, reg_ext, 0);
+ build_table_filename(name, sizeof(name), db, file_name_str, reg_ext, 0);
if (my_access(name, F_OK))
{
- DBUG_PRINT("info", ("%s must be discovered", file_name));
+ DBUG_PRINT("info", ("%s must be discovered", file_name_str));
// File is in list of ndb tables and not in ok_tables
// This table need to be created
- create_list.push_back(thd->strdup(file_name));
+ create_list.push_back(thd->strdup(file_name_str));
}
}
}
@@ -6648,14 +6650,14 @@ int ndbcluster_find_files(handlerton *ht
{
// Delete old files
List_iterator_fast<char> it3(delete_list);
- while ((file_name=it3++))
+ while ((file_name_str= it3++))
{
- DBUG_PRINT("info", ("Remove table %s/%s", db, file_name));
+ DBUG_PRINT("info", ("Remove table %s/%s", db, file_name_str));
// Delete the table and all related files
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.db= (char*) db;
- table_list.alias= table_list.table_name= (char*)file_name;
+ table_list.alias= table_list.table_name= (char*)file_name_str;
(void)mysql_rm_table_part2(thd, &table_list,
/* if_exists */ FALSE,
/* drop_temporary */
FALSE,
@@ -6668,11 +6670,16 @@ int ndbcluster_find_files(handlerton *ht
// Create new files
List_iterator_fast<char> it2(create_list);
- while ((file_name=it2++))
+ while ((file_name_str=it2++))
{
- DBUG_PRINT("info", ("Table %s need discovery", file_name));
- if (ndb_create_table_from_engine(thd, db, file_name) == 0)
- files->push_back(thd->strdup(file_name));
+ DBUG_PRINT("info", ("Table %s need discovery", file_name_str));
+ if (ndb_create_table_from_engine(thd, db, file_name_str) == 0)
+ {
+ LEX_STRING *tmp_file_name=
+ make_lex_string(thd, tmp_file_name, file_name_str,
+ strlen(file_name_str), TRUE);
+ files->push_back(tmp_file_name);
+ }
}
pthread_mutex_unlock(&LOCK_open);
@@ -6686,8 +6693,8 @@ int ndbcluster_find_files(handlerton *ht
uint count = 0;
while (count++ < files->elements)
{
- file_name = (char *)files->pop();
- if (!strcmp(file_name, NDB_SCHEMA_TABLE))
+ file_name = (LEX_STRING *)files->pop();
+ if (!strcmp(file_name->str, NDB_SCHEMA_TABLE))
{
DBUG_PRINT("info", ("skip %s.%s table, it should be hidden to user",
NDB_REP_DB, NDB_SCHEMA_TABLE));
--- 1.169/sql/ha_ndbcluster.h 2007-02-12 23:58:16 +04:00
+++ 1.170/sql/ha_ndbcluster.h 2007-03-21 10:53:39 +04:00
@@ -991,7 +991,7 @@ extern SHOW_VAR ndb_status_variables[];
int ndbcluster_discover(THD* thd, const char* dbname, const char* name,
const void** frmblob, uint* frmlen);
int ndbcluster_find_files(THD *thd,const char *db,const char *path,
- const char *wild, bool dir, List<char> *files);
+ const char *wild, bool dir, List<LEX_STRING> *files);
int ndbcluster_table_exists_in_engine(THD* thd,
const char *db, const char *name);
void ndbcluster_print_error(int error, const NdbOperation *error_op);
--- 1.2/mysql-test/r/ndb_temporary.result 2006-02-18 02:41:53 +04:00
+++ 1.3/mysql-test/r/ndb_temporary.result 2007-03-21 10:53:39 +04:00
@@ -9,7 +9,7 @@ SET SESSION storage_engine=NDBCLUSTER;
create table t1 (a int key);
select engine from information_schema.tables where table_name = 't1';
engine
-NDBCLUSTER
+ndbcluster
drop table t1;
create temporary table t1 (a int key);
show create table t1;
--- 1.102/sql/ha_ndbcluster_binlog.cc 2007-02-07 01:06:11 +04:00
+++ 1.103/sql/ha_ndbcluster_binlog.cc 2007-03-21 10:53:39 +04:00
@@ -2390,8 +2390,8 @@ ndbcluster_check_if_local_tables_in_db(T
{
DBUG_ENTER("ndbcluster_check_if_local_tables_in_db");
DBUG_PRINT("info", ("Looking for files in directory %s", dbname));
- char *tabname;
- List<char> files;
+ LEX_STRING *tabname;
+ List<LEX_STRING> files;
char path[FN_REFLEN];
build_table_filename(path, sizeof(path), dbname, "", "", 0);
@@ -2403,8 +2403,8 @@ ndbcluster_check_if_local_tables_in_db(T
DBUG_PRINT("info",("found: %d files", files.elements));
while ((tabname= files.pop()))
{
- DBUG_PRINT("info", ("Found table %s", tabname));
- if (ndbcluster_check_if_local_table(dbname, tabname))
+ DBUG_PRINT("info", ("Found table %s", tabname->str));
+ if (ndbcluster_check_if_local_table(dbname, tabname->str))
DBUG_RETURN(true);
}
| Thread |
|---|
| • bk commit into 5.1 tree (gluh:1.2439) | gluh | 21 Mar |