65
65
static void store_key_options(Session *session, String *packet, Table *table,
68
static vector<ST_SCHEMA_TABLE *> all_schema_tables;
70
static void add_infoschema_table(ST_SCHEMA_TABLE *table)
72
all_schema_tables.push_back(table);
75
static void remove_infoschema_table(ST_SCHEMA_TABLE *table)
77
all_schema_tables.erase(remove_if(all_schema_tables.begin(),
78
all_schema_tables.end(),
79
bind2nd(equal_to<ST_SCHEMA_TABLE *>(),
81
all_schema_tables.end());
70
85
int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)
2000
static bool add_schema_table(Session *session, st_plugin_int *plugin,
2015
class AddSchemaTable : public unary_function<ST_SCHEMA_TABLE *, bool>
2003
LEX_STRING *file_name= 0;
2004
st_add_schema_table *data= (st_add_schema_table *)p_data;
2005
List<LEX_STRING> *file_list= data->files;
2006
const char *wild= data->wild;
2007
ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
2009
if (schema_table->hidden)
2018
st_add_schema_table *data;
2020
AddSchemaTable(Session *session_arg, st_add_schema_table *data_arg)
2021
: session(session_arg), data(data_arg) {}
2022
result_type operator() (argument_type schema_table)
2013
if (lower_case_table_names)
2024
LEX_STRING *file_name= 0;
2025
List<LEX_STRING> *file_list= data->files;
2026
const char *wild= data->wild;
2028
if (schema_table->hidden)
2015
if (wild_case_compare(files_charset_info,
2016
schema_table->table_name,
2032
if (lower_case_table_names)
2034
if (wild_case_compare(files_charset_info,
2035
schema_table->table_name,
2039
else if (wild_compare(schema_table->table_name, wild, 0))
2020
else if (wild_compare(schema_table->table_name, wild, 0))
2043
if ((file_name= session->make_lex_string(file_name, schema_table->table_name,
2044
strlen(schema_table->table_name),
2046
!file_list->push_back(file_name))
2024
if ((file_name= session->make_lex_string(file_name, schema_table->table_name,
2025
strlen(schema_table->table_name),
2027
!file_list->push_back(file_name))
2033
2053
int schema_tables_add(Session *session, List<LEX_STRING> *files, const char *wild)
2063
2083
add_data.files= files;
2064
2084
add_data.wild= wild;
2065
if (plugin_foreach(session, add_schema_table,
2066
DRIZZLE_INFORMATION_SCHEMA_PLUGIN, &add_data))
2085
vector<ST_SCHEMA_TABLE *>::iterator iter=
2086
find_if(all_schema_tables.begin(), all_schema_tables.end(),
2087
AddSchemaTable(session, &add_data));
2088
if (iter != all_schema_tables.end())
3644
struct schema_table_ref
3665
class FindSchemaTableByName : public unary_function<ST_SCHEMA_TABLE *, bool>
3646
3667
const char *table_name;
3647
ST_SCHEMA_TABLE *schema_table;
3669
FindSchemaTableByName(const char *table_name_arg)
3670
: table_name(table_name_arg) {}
3671
result_type operator() (argument_type schema_table)
3673
return !my_strcasecmp(system_charset_info,
3674
schema_table->table_name,
3652
3681
Find schema_tables elment by name
3655
find_schema_table_in_plugin()
3656
session thread handler
3658
table_name table name
3662
1 found the schema table
3664
static bool find_schema_table_in_plugin(Session *, st_plugin_int *plugin,
3667
schema_table_ref *p_schema_table= (schema_table_ref *)p_table;
3668
const char* table_name= p_schema_table->table_name;
3669
ST_SCHEMA_TABLE *schema_table= plugin_data(plugin, ST_SCHEMA_TABLE *);
3671
if (!my_strcasecmp(system_charset_info,
3672
schema_table->table_name,
3674
p_schema_table->schema_table= schema_table;
3683
Find schema_tables elment by name
3686
3684
find_schema_table()
3687
3685
session thread handler
3688
3686
table_name table name
3692
3690
# pointer to 'schema_tables' element
3695
ST_SCHEMA_TABLE *find_schema_table(Session *session, const char* table_name)
3693
ST_SCHEMA_TABLE *find_schema_table(Session *, const char* table_name)
3697
schema_table_ref schema_table_a;
3698
3695
ST_SCHEMA_TABLE *schema_table= schema_tables;
3700
3697
for (; schema_table->table_name; schema_table++)
3705
3702
return(schema_table);
3708
schema_table_a.table_name= table_name;
3709
if (plugin_foreach(session, find_schema_table_in_plugin,
3710
DRIZZLE_INFORMATION_SCHEMA_PLUGIN, &schema_table_a))
3711
return(schema_table_a.schema_table);
3705
vector<ST_SCHEMA_TABLE *>::iterator iter=
3706
find_if(all_schema_tables.begin(), all_schema_tables.end(),
3707
FindSchemaTableByName(table_name));
3708
if (iter != all_schema_tables.end())