174
174
switch (plug->license) {
175
175
case PLUGIN_LICENSE_GPL:
176
table->field[7]->store(PLUGIN_LICENSE_GPL_STRING,
176
table->field[7]->store(PLUGIN_LICENSE_GPL_STRING,
177
177
strlen(PLUGIN_LICENSE_GPL_STRING), cs);
179
179
case PLUGIN_LICENSE_BSD:
180
table->field[7]->store(PLUGIN_LICENSE_BSD_STRING,
180
table->field[7]->store(PLUGIN_LICENSE_BSD_STRING,
181
181
strlen(PLUGIN_LICENSE_BSD_STRING), cs);
184
table->field[7]->store(PLUGIN_LICENSE_PROPRIETARY_STRING,
184
table->field[7]->store(PLUGIN_LICENSE_PROPRIETARY_STRING,
185
185
strlen(PLUGIN_LICENSE_PROPRIETARY_STRING), cs);
1085
1085
packet->append(buff, (uint) (end - buff));
1088
assert(test(key_info->flags & HA_USES_COMMENT) ==
1088
assert(test(key_info->flags & HA_USES_COMMENT) ==
1089
1089
(key_info->comment.length > 0));
1090
1090
if (key_info->flags & HA_USES_COMMENT)
1092
1092
packet->append(STRING_WITH_LEN(" COMMENT "));
1093
append_unescaped(packet, key_info->comment.str,
1093
append_unescaped(packet, key_info->comment.str,
1094
1094
key_info->comment.length);
1736
@brief Get lookup value from the part of 'WHERE' condition
1736
@brief Get lookup value from the part of 'WHERE' condition
1738
@details This function gets lookup value from
1739
the part of 'WHERE' condition if it's possible and
1738
@details This function gets lookup value from
1739
the part of 'WHERE' condition if it's possible and
1740
1740
fill appropriate lookup_field_vals struct field
1741
1741
with this value.
1743
1743
@param[in] session thread handler
1744
1744
@param[in] item_func part of WHERE condition
1745
1745
@param[in] table I_S table
1746
@param[in, out] lookup_field_vals Struct which holds lookup values
1746
@param[in, out] lookup_field_vals Struct which holds lookup values
1820
@brief Calculates lookup values from 'WHERE' condition
1820
@brief Calculates lookup values from 'WHERE' condition
1822
1822
@details This function calculates lookup value(database name, table name)
1823
from 'WHERE' condition if it's possible and
1823
from 'WHERE' condition if it's possible and
1824
1824
fill lookup_field_vals struct fields with these values.
1826
1826
@param[in] session thread handler
1827
1827
@param[in] cond WHERE condition
1828
1828
@param[in] table I_S table
1829
@param[in, out] lookup_field_vals Struct which holds lookup values
1829
@param[in, out] lookup_field_vals Struct which holds lookup values
2301
2301
Let us set fake sql_command so views won't try to merge
2302
2302
themselves into main statement. If we don't do this,
2303
2303
SELECT * from information_schema.xxxx will cause problems.
2304
SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
2304
SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
2306
2306
lex->sql_command= SQLCOM_SHOW_FIELDS;
2307
2307
res= open_normal_and_derived_tables(session, show_table_list,
2311
2311
get_all_tables() returns 1 on failure and 0 on success thus
2312
2312
return only these and not the result code of ::process_table()
2314
We should use show_table_list->alias instead of
2314
We should use show_table_list->alias instead of
2315
2315
show_table_list->table_name because table_name
2316
2316
could be changed during opening of I_S tables. It's safe
2317
to use alias because alias contains original table name
2318
in this case(this part of code is used only for
2317
to use alias because alias contains original table name
2318
in this case(this part of code is used only for
2319
2319
'show columns' & 'show statistics' commands).
2321
2321
table_name= session->make_lex_string(&tmp_lex_string1, show_table_list->alias,
2322
2322
strlen(show_table_list->alias), false);
2323
2323
db_name= session->make_lex_string(&tmp_lex_string, show_table_list->db,
2324
2324
show_table_list->db_length, false);
2327
2327
error= test(schema_table->process_table(session, show_table_list,
2328
2328
table, res, db_name,
2896
2896
ptr= strxmov(ptr, " transactional=",
2897
2897
ha_choice_values[(uint) share->transactional], NULL);
2898
2898
table->field[19]->store(option_buff+1,
2899
(ptr == option_buff ? 0 :
2899
(ptr == option_buff ? 0 :
2900
2900
(uint) (ptr-option_buff)-1), cs);
2902
2902
tmp_buff= (share->table_charset ?
3306
3306
CHARSET_INFO **cl;
3307
3307
const CHARSET_INFO *tmp_cs= cs[0];
3308
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
3308
if (!tmp_cs || !(tmp_cs->state & MY_CS_AVAILABLE) ||
3309
3309
!(tmp_cs->state & MY_CS_PRIMARY))
3311
3311
for (cl= all_charsets; cl < all_charsets+255 ;cl ++)
3313
3313
const CHARSET_INFO *tmp_cl= cl[0];
3314
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
3314
if (!tmp_cl || !(tmp_cl->state & MY_CS_AVAILABLE) ||
3315
3315
!my_charset_same(tmp_cs,tmp_cl))
3317
3317
restore_record(table, s->default_values);
3409
3409
table->field[14]->store("", 0, cs);
3410
3410
table->field[14]->set_notnull();
3411
assert(test(key_info->flags & HA_USES_COMMENT) ==
3411
assert(test(key_info->flags & HA_USES_COMMENT) ==
3412
3412
(key_info->comment.length > 0));
3413
3413
if (key_info->flags & HA_USES_COMMENT)
3414
table->field[15]->store(key_info->comment.str,
3414
table->field[15]->store(key_info->comment.str,
3415
3415
key_info->comment.length, cs);
3416
3416
if (schema_table_store_record(session, table))
3485
3485
List_iterator_fast<FOREIGN_KEY_INFO> it(f_key_list);
3486
3486
while ((f_key_info=it++))
3488
if (store_constraints(session, table, db_name, table_name,
3488
if (store_constraints(session, table, db_name, table_name,
3489
3489
f_key_info->forein_id->str,
3490
3490
strlen(f_key_info->forein_id->str),
3491
3491
"FOREIGN KEY", 11))
3548
3548
restore_record(table, s->default_values);
3549
3549
store_key_column_usage(table, db_name, table_name,
3550
3550
key_info->name,
3551
strlen(key_info->name),
3552
key_part->field->field_name,
3551
strlen(key_info->name),
3552
key_part->field->field_name,
3553
3553
strlen(key_part->field->field_name),
3554
3554
(int64_t) f_idx);
3555
3555
if (schema_table_store_record(session, table))
3740
3740
table->field[9]->store(table_name->str, table_name->length, cs);
3741
3741
table->field[2]->store(f_key_info->forein_id->str,
3742
3742
f_key_info->forein_id->length, cs);
3743
table->field[4]->store(f_key_info->referenced_db->str,
3743
table->field[4]->store(f_key_info->referenced_db->str,
3744
3744
f_key_info->referenced_db->length, cs);
3745
table->field[10]->store(f_key_info->referenced_table->str,
3745
table->field[10]->store(f_key_info->referenced_table->str,
3746
3746
f_key_info->referenced_table->length, cs);
3747
3747
if (f_key_info->referenced_key_name)
3749
table->field[5]->store(f_key_info->referenced_key_name->str,
3749
table->field[5]->store(f_key_info->referenced_key_name->str,
3750
3750
f_key_info->referenced_key_name->length, cs);
3751
3751
table->field[5]->set_notnull();
3754
3754
table->field[5]->set_null();
3755
3755
table->field[6]->store(STRING_WITH_LEN("NONE"), cs);
3756
table->field[7]->store(f_key_info->update_method->str,
3756
table->field[7]->store(f_key_info->update_method->str,
3757
3757
f_key_info->update_method->length, cs);
3758
table->field[8]->store(f_key_info->delete_method->str,
3758
table->field[8]->store(f_key_info->delete_method->str,
3759
3759
f_key_info->delete_method->length, cs);
3760
3760
if (schema_table_store_record(session, table))
3941
3941
tmp_table_param->schema_table= 1;
3942
3942
SELECT_LEX *select_lex= session->lex->current_select;
3943
3943
if (!(table= create_tmp_table(session, tmp_table_param,
3944
field_list, (order_st*) 0, 0, 0,
3944
field_list, (order_st*) 0, 0, 0,
3945
3945
(select_lex->options | session->options |
3946
3946
TMP_TABLE_ALL_COLUMNS),
3947
3947
HA_POS_ERROR, table_list->alias)))
4343
4343
{"ROW_FORMAT", 10, DRIZZLE_TYPE_VARCHAR, 0, 1, "Row_format", OPEN_FULL_TABLE},
4344
4344
{"TABLE_ROWS", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4345
4345
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Rows", OPEN_FULL_TABLE},
4346
{"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4346
{"AVG_ROW_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4347
4347
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Avg_row_length", OPEN_FULL_TABLE},
4348
{"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4348
{"DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4349
4349
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_length", OPEN_FULL_TABLE},
4350
4350
{"MAX_DATA_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4351
4351
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Max_data_length", OPEN_FULL_TABLE},
4352
{"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4352
{"INDEX_LENGTH", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4353
4353
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Index_length", OPEN_FULL_TABLE},
4354
4354
{"DATA_FREE", MY_INT64_NUM_DECIMAL_DIGITS, DRIZZLE_TYPE_LONGLONG, 0,
4355
4355
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Data_free", OPEN_FULL_TABLE},
4356
{"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , DRIZZLE_TYPE_LONGLONG, 0,
4356
{"AUTO_INCREMENT", MY_INT64_NUM_DECIMAL_DIGITS , DRIZZLE_TYPE_LONGLONG, 0,
4357
4357
(MY_I_S_MAYBE_NULL | MY_I_S_UNSIGNED), "Auto_increment", OPEN_FULL_TABLE},
4358
4358
{"CREATE_TIME", 0, DRIZZLE_TYPE_DATETIME, 0, 1, "Create_time", OPEN_FULL_TABLE},
4359
4359
{"UPDATE_TIME", 0, DRIZZLE_TYPE_DATETIME, 0, 1, "Update_time", OPEN_FULL_TABLE},
4553
4553
ST_FIELD_INFO plugin_fields_info[]=
4555
{"PLUGIN_NAME", NAME_CHAR_LEN, DRIZZLE_TYPE_VARCHAR, 0, 0, "Name",
4555
{"PLUGIN_NAME", NAME_CHAR_LEN, DRIZZLE_TYPE_VARCHAR, 0, 0, "Name",
4556
4556
SKIP_OPEN_TABLE},
4557
4557
{"PLUGIN_VERSION", 20, DRIZZLE_TYPE_VARCHAR, 0, 0, 0, SKIP_OPEN_TABLE},
4558
4558
{"PLUGIN_STATUS", 10, DRIZZLE_TYPE_VARCHAR, 0, 0, "Status", SKIP_OPEN_TABLE},
4598
4598
ST_SCHEMA_TABLE schema_tables[]=
4600
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
4600
{"CHARACTER_SETS", charsets_fields_info, create_schema_table,
4601
4601
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
4602
{"COLLATIONS", collation_fields_info, create_schema_table,
4602
{"COLLATIONS", collation_fields_info, create_schema_table,
4603
4603
fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
4604
4604
{"COLLATION_CHARACTER_SET_APPLICABILITY", coll_charset_app_fields_info,
4605
4605
create_schema_table, fill_schema_coll_charset_app, 0, 0, -1, -1, 0, 0},
4606
{"COLUMNS", columns_fields_info, create_schema_table,
4606
{"COLUMNS", columns_fields_info, create_schema_table,
4607
4607
get_all_tables, make_columns_old_format, get_schema_column_record, 1, 2, 0,
4608
4608
OPTIMIZE_I_S_TABLE},
4609
4609
{"GLOBAL_STATUS", variables_fields_info, create_schema_table,
4628
4628
fill_status, make_old_format, 0, -1, -1, 0, 0},
4629
4629
{"SESSION_VARIABLES", variables_fields_info, create_schema_table,
4630
4630
fill_variables, make_old_format, 0, -1, -1, 0, 0},
4631
{"STATISTICS", stat_fields_info, create_schema_table,
4631
{"STATISTICS", stat_fields_info, create_schema_table,
4632
4632
get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
4633
4633
OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE},
4634
{"STATUS", variables_fields_info, create_schema_table, fill_status,
4634
{"STATUS", variables_fields_info, create_schema_table, fill_status,
4635
4635
make_old_format, 0, -1, -1, 1, 0},
4636
{"TABLES", tables_fields_info, create_schema_table,
4636
{"TABLES", tables_fields_info, create_schema_table,
4637
4637
get_all_tables, make_old_format, get_schema_tables_record, 1, 2, 0,
4638
4638
OPTIMIZE_I_S_TABLE},
4639
4639
{"TABLE_CONSTRAINTS", table_constraints_fields_info, create_schema_table,
4666
4666
schema_table->create_table= create_schema_table;
4667
4667
schema_table->old_format= make_old_format;
4668
schema_table->idx_field1= -1,
4669
schema_table->idx_field2= -1;
4668
schema_table->idx_field1= -1,
4669
schema_table->idx_field2= -1;
4671
4671
/* Make the name available to the init() function. */
4672
4672
schema_table->table_name= plugin->name.str;