32
32
using namespace std;
34
int CharSetISMethods::fillTable(Session *session, TableList *tables, COND *)
37
const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
38
Table *table= tables->table;
39
const CHARSET_INFO * const scs= system_charset_info;
41
for (cs= all_charsets ; cs < all_charsets+255 ; cs++)
43
const CHARSET_INFO * const tmp_cs= cs[0];
44
if (tmp_cs && (tmp_cs->state & MY_CS_PRIMARY) &&
45
(tmp_cs->state & MY_CS_AVAILABLE) &&
46
!(tmp_cs->state & MY_CS_HIDDEN) &&
48
wild_case_compare(scs, tmp_cs->csname,wild)))
51
table->restoreRecordAsDefault();
52
table->field[0]->store(tmp_cs->csname, strlen(tmp_cs->csname), scs);
53
table->field[1]->store(tmp_cs->name, strlen(tmp_cs->name), scs);
54
comment= tmp_cs->comment ? tmp_cs->comment : "";
55
table->field[2]->store(comment, strlen(comment), scs);
56
table->field[3]->store((int64_t) tmp_cs->mbmaxlen, true);
57
if (schema_table_store_record(session, table))
64
int CharSetISMethods::oldFormat(Session *session, InfoSchemaTable *schema_table)
67
int fields_arr[]= {0, 2, 1, 3, -1};
68
int *field_num= fields_arr;
69
const InfoSchemaTable::Columns columns= schema_table->getColumns();
70
const ColumnInfo *column;
71
Name_resolution_context *context= &session->lex->select_lex.context;
73
for (; *field_num >= 0; field_num++)
75
column= columns[*field_num];
76
Item_field *field= new Item_field(context,
77
NULL, NULL, column->getName().c_str());
80
field->set_name(column->getOldName().c_str(),
81
column->getOldName().length(),
83
if (session->add_item_to_list(field))
90
int CollationISMethods::fillTable(Session *session, TableList *tables, COND *)
93
const char *wild= session->lex->wild ? session->lex->wild->ptr() : NULL;
94
Table *table= tables->table;
95
const CHARSET_INFO * const scs= system_charset_info;
96
for (cs= all_charsets ; cs < all_charsets+255 ; cs++ )
99
const CHARSET_INFO *tmp_cs= cs[0];
100
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
101
(tmp_cs->state & MY_CS_HIDDEN) ||
102
!(tmp_cs->state & MY_CS_PRIMARY))
104
for (cl= all_charsets; cl < all_charsets+255 ;cl ++)
106
const CHARSET_INFO *tmp_cl= cl[0];
107
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
108
!my_charset_same(tmp_cs, tmp_cl))
110
if (!(wild && wild[0] &&
111
wild_case_compare(scs, tmp_cl->name,wild)))
113
const char *tmp_buff;
114
table->restoreRecordAsDefault();
115
table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
116
table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
117
table->field[2]->store((int64_t) tmp_cl->number, true);
118
tmp_buff= (tmp_cl->state & MY_CS_PRIMARY) ? "Yes" : "";
119
table->field[3]->store(tmp_buff, strlen(tmp_buff), scs);
120
tmp_buff= (tmp_cl->state & MY_CS_COMPILED)? "Yes" : "";
121
table->field[4]->store(tmp_buff, strlen(tmp_buff), scs);
122
table->field[5]->store((int64_t) tmp_cl->strxfrm_multiply, true);
123
if (schema_table_store_record(session, table))
131
int CollCharISMethods::fillTable(Session *session, TableList *tables, COND *)
134
Table *table= tables->table;
135
const CHARSET_INFO * const scs= system_charset_info;
136
for (cs= all_charsets ; cs < all_charsets+255 ; cs++ )
139
const CHARSET_INFO *tmp_cs= cs[0];
140
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
141
!(tmp_cs->state & MY_CS_PRIMARY))
143
for (cl= all_charsets; cl < all_charsets+255 ;cl ++)
145
const CHARSET_INFO *tmp_cl= cl[0];
146
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
147
!my_charset_same(tmp_cs,tmp_cl))
149
table->restoreRecordAsDefault();
150
table->field[0]->store(tmp_cl->name, strlen(tmp_cl->name), scs);
151
table->field[1]->store(tmp_cl->csname , strlen(tmp_cl->csname), scs);
152
if (schema_table_store_record(session, table))
34
159
int ProcessListISMethods::fillTable(Session* session, TableList* tables, COND*)
36
161
Table *table= tables->table;