Commit 768c5188 authored by xing-zhi, jiang's avatar xing-zhi, jiang Committed by Robert Bindar

MDEV-25129 Add KEYWORDS view to the INFORMATION_SCHEMA

Add KEYWORDS table and SQL_FUNCTIONS table to INFORMATION_SCHEMA.
This commits needs some minor changes when propagated upwards
(e.g. func_array in item_create.cc has a termination element that
 doesn't exist in later versions of MariaDB)
parent 58252fff
......@@ -517,3 +517,5 @@ compile_commands.json
# Visual Studio Code workspace
.vscode/
.cache/clangd
......@@ -65,6 +65,7 @@ GEOMETRY_COLUMNS
GLOBAL_STATUS
GLOBAL_VARIABLES
INDEX_STATISTICS
KEYWORDS
KEY_CACHES
KEY_COLUMN_USAGE
PARAMETERS
......@@ -79,6 +80,7 @@ SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
SPATIAL_REF_SYS
SQL_FUNCTIONS
STATISTICS
SYSTEM_VARIABLES
TABLES
......
......@@ -41,6 +41,7 @@ INNODB_SYS_VIRTUAL
INNODB_TABLESPACES_ENCRYPTION
INNODB_TABLESPACES_SCRUBBING
INNODB_TRX
KEYWORDS
KEY_CACHES
KEY_COLUMN_USAGE
PARAMETERS
......@@ -55,6 +56,7 @@ SCHEMA_PRIVILEGES
SESSION_STATUS
SESSION_VARIABLES
SPATIAL_REF_SYS
SQL_FUNCTIONS
STATISTICS
SYSTEM_VARIABLES
TABLES
......@@ -121,6 +123,7 @@ INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
......@@ -135,6 +138,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
SPATIAL_REF_SYS SRID
SQL_FUNCTIONS FUNCTION
STATISTICS TABLE_SCHEMA
SYSTEM_VARIABLES VARIABLE_NAME
TABLES TABLE_SCHEMA
......@@ -201,6 +205,7 @@ INNODB_SYS_VIRTUAL TABLE_ID
INNODB_TABLESPACES_ENCRYPTION SPACE
INNODB_TABLESPACES_SCRUBBING SPACE
INNODB_TRX trx_id
KEYWORDS WORD
KEY_CACHES KEY_CACHE_NAME
KEY_COLUMN_USAGE CONSTRAINT_SCHEMA
PARAMETERS SPECIFIC_SCHEMA
......@@ -215,6 +220,7 @@ SCHEMA_PRIVILEGES TABLE_SCHEMA
SESSION_STATUS VARIABLE_NAME
SESSION_VARIABLES VARIABLE_NAME
SPATIAL_REF_SYS SRID
SQL_FUNCTIONS FUNCTION
STATISTICS TABLE_SCHEMA
SYSTEM_VARIABLES VARIABLE_NAME
TABLES TABLE_SCHEMA
......@@ -356,6 +362,7 @@ Database: information_schema
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEYWORDS |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
| PARAMETERS |
......@@ -370,6 +377,7 @@ Database: information_schema
| SESSION_STATUS |
| SESSION_VARIABLES |
| SPATIAL_REF_SYS |
| SQL_FUNCTIONS |
| STATISTICS |
| SYSTEM_VARIABLES |
| TABLES |
......@@ -426,6 +434,7 @@ Database: INFORMATION_SCHEMA
| INNODB_TABLESPACES_ENCRYPTION |
| INNODB_TABLESPACES_SCRUBBING |
| INNODB_TRX |
| KEYWORDS |
| KEY_CACHES |
| KEY_COLUMN_USAGE |
| PARAMETERS |
......@@ -440,6 +449,7 @@ Database: INFORMATION_SCHEMA
| SESSION_STATUS |
| SESSION_VARIABLES |
| SPATIAL_REF_SYS |
| SQL_FUNCTIONS |
| STATISTICS |
| SYSTEM_VARIABLES |
| TABLES |
......@@ -459,5 +469,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 65
information_schema 67
mysql 30
......@@ -181,6 +181,7 @@ def information_schema INDEX_STATISTICS INDEX_NAME 3 '' NO varchar 192 576 NULL
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema INDEX_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select NEVER NULL
def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) select NEVER NULL
def information_schema KEYWORDS WORD 1 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema KEY_CACHES BLOCK_SIZE 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL
def information_schema KEY_CACHES DIRTY_BLOCKS 8 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL
def information_schema KEY_CACHES FULL_SIZE 4 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select NEVER NULL
......@@ -336,6 +337,7 @@ def information_schema SPATIAL_REF_SYS AUTH_NAME 2 '' NO varchar 512 1536 NULL N
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(5) select NEVER NULL
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) select NEVER NULL
def information_schema SPATIAL_REF_SYS SRTEXT 4 '' NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) select NEVER NULL
def information_schema SQL_FUNCTIONS FUNCTION 1 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) select NEVER NULL
def information_schema STATISTICS COLUMN_NAME 8 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
......@@ -716,6 +718,7 @@ NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL small
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema INDEX_STATISTICS ROWS_READ bigint NULL NULL NULL NULL bigint(21)
3.0000 information_schema KEYWORDS WORD varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema KEY_CACHES KEY_CACHE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema KEY_CACHES SEGMENTS int NULL NULL NULL NULL int(3) unsigned
NULL information_schema KEY_CACHES SEGMENT_NUMBER int NULL NULL NULL NULL int(3) unsigned
......@@ -871,6 +874,7 @@ NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smalli
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5)
3.0000 information_schema SPATIAL_REF_SYS SRTEXT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SQL_FUNCTIONS FUNCTION varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
......
......@@ -181,6 +181,7 @@ def information_schema INDEX_STATISTICS INDEX_NAME 3 '' NO varchar 192 576 NULL
def information_schema INDEX_STATISTICS ROWS_READ 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema INDEX_STATISTICS TABLE_NAME 2 '' NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) NEVER NULL
def information_schema INDEX_STATISTICS TABLE_SCHEMA 1 '' NO varchar 192 576 NULL NULL NULL utf8 utf8_general_ci varchar(192) NEVER NULL
def information_schema KEYWORDS WORD 1 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema KEY_CACHES BLOCK_SIZE 5 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL
def information_schema KEY_CACHES DIRTY_BLOCKS 8 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL
def information_schema KEY_CACHES FULL_SIZE 4 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL
......@@ -336,6 +337,7 @@ def information_schema SPATIAL_REF_SYS AUTH_NAME 2 '' NO varchar 512 1536 NULL N
def information_schema SPATIAL_REF_SYS AUTH_SRID 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(5) NEVER NULL
def information_schema SPATIAL_REF_SYS SRID 1 0 NO smallint NULL NULL 5 0 NULL NULL NULL smallint(5) NEVER NULL
def information_schema SPATIAL_REF_SYS SRTEXT 4 '' NO varchar 2048 6144 NULL NULL NULL utf8 utf8_general_ci varchar(2048) NEVER NULL
def information_schema SQL_FUNCTIONS FUNCTION 1 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema STATISTICS CARDINALITY 10 NULL YES bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema STATISTICS COLLATION 9 NULL YES varchar 1 3 NULL NULL NULL utf8 utf8_general_ci varchar(1) NEVER NULL
def information_schema STATISTICS COLUMN_NAME 8 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
......@@ -716,6 +718,7 @@ NULL information_schema GEOMETRY_COLUMNS SRID smallint NULL NULL NULL NULL small
3.0000 information_schema INDEX_STATISTICS TABLE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
3.0000 information_schema INDEX_STATISTICS INDEX_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema INDEX_STATISTICS ROWS_READ bigint NULL NULL NULL NULL bigint(21)
3.0000 information_schema KEYWORDS WORD varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema KEY_CACHES KEY_CACHE_NAME varchar 192 576 utf8 utf8_general_ci varchar(192)
NULL information_schema KEY_CACHES SEGMENTS int NULL NULL NULL NULL int(3) unsigned
NULL information_schema KEY_CACHES SEGMENT_NUMBER int NULL NULL NULL NULL int(3) unsigned
......@@ -871,6 +874,7 @@ NULL information_schema SPATIAL_REF_SYS SRID smallint NULL NULL NULL NULL smalli
3.0000 information_schema SPATIAL_REF_SYS AUTH_NAME varchar 512 1536 utf8 utf8_general_ci varchar(512)
NULL information_schema SPATIAL_REF_SYS AUTH_SRID int NULL NULL NULL NULL int(5)
3.0000 information_schema SPATIAL_REF_SYS SRTEXT varchar 2048 6144 utf8 utf8_general_ci varchar(2048)
3.0000 information_schema SQL_FUNCTIONS FUNCTION varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema STATISTICS TABLE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema STATISTICS TABLE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema STATISTICS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
......
......@@ -405,6 +405,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEYWORDS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -704,6 +727,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME SQL_FUNCTIONS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -1364,6 +1410,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEYWORDS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -1663,6 +1732,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME SQL_FUNCTIONS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......
......@@ -405,6 +405,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEYWORDS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -704,6 +727,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME SQL_FUNCTIONS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -1364,6 +1410,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEYWORDS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME KEY_CACHES
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......@@ -1663,6 +1732,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME SQL_FUNCTIONS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 11
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
......
......@@ -741,6 +741,7 @@ enum enum_schema_tables
SCH_FILES,
SCH_GLOBAL_STATUS,
SCH_GLOBAL_VARIABLES,
SCH_KEYWORDS,
SCH_KEY_CACHES,
SCH_KEY_COLUMN_USAGE,
SCH_OPEN_TABLES,
......@@ -756,6 +757,7 @@ enum enum_schema_tables
SCH_SESSION_STATUS,
SCH_SESSION_VARIABLES,
SCH_STATISTICS,
SCH_SQL_FUNCTIONS,
SCH_SYSTEM_VARIABLES,
SCH_TABLES,
SCH_TABLESPACES,
......
......@@ -6745,13 +6745,6 @@ Create_func_year_week::create_native(THD *thd, LEX_STRING name,
return func;
}
struct Native_func_registry
{
LEX_STRING name;
Create_func *builder;
};
#define BUILDER(F) & F::s_singleton
#ifdef HAVE_SPATIAL
......@@ -6771,7 +6764,7 @@ struct Native_func_registry
- keep 1 line per entry, it makes grep | sort easier
*/
static Native_func_registry func_array[] =
Native_func_registry func_array[] =
{
{ { C_STRING_WITH_LEN("ABS") }, BUILDER(Create_func_abs)},
{ { C_STRING_WITH_LEN("ACOS") }, BUILDER(Create_func_acos)},
......@@ -7113,6 +7106,8 @@ static Native_func_registry func_array[] =
{ {0, 0}, NULL}
};
size_t func_array_length= sizeof(func_array) / sizeof(Native_func_registry) - 1;
static HASH native_functions_hash;
extern "C" uchar*
......
......@@ -183,6 +183,12 @@ Item *create_temporal_literal(THD *thd, const String *str,
type, send_error);
}
struct Native_func_registry
{
LEX_STRING name;
Create_func *builder;
};
int item_create_init();
void item_create_cleanup();
......
......@@ -45,7 +45,7 @@ SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
lists
*/
static SYMBOL symbols[] = {
SYMBOL symbols[] = {
{ "&&", SYM(AND_AND_SYM)},
{ "<=", SYM(LE)},
{ "<>", SYM(NE)},
......@@ -687,7 +687,7 @@ static SYMBOL symbols[] = {
};
static SYMBOL sql_functions[] = {
SYMBOL sql_functions[] = {
{ "ADDDATE", SYM(ADDDATE_SYM)},
{ "BIT_AND", SYM(BIT_AND)},
{ "BIT_OR", SYM(BIT_OR)},
......@@ -732,4 +732,7 @@ static SYMBOL sql_functions[] = {
{ "VAR_SAMP", SYM(VAR_SAMP_SYM)},
};
size_t symbols_length= sizeof(symbols) / sizeof(SYMBOL);
size_t sql_functions_length= sizeof(sql_functions) / sizeof(SYMBOL);
#endif /* LEX_INCLUDED */
......@@ -62,6 +62,19 @@
#ifdef WITH_PARTITION_STORAGE_ENGINE
#include "ha_partition.h"
#endif
#include "lex_symbol.h"
#define KEYWORD_SIZE 64
extern SYMBOL symbols[];
extern size_t symbols_length;
extern SYMBOL sql_functions[];
extern size_t sql_functions_length;
extern Native_func_registry func_array[];
extern size_t func_array_length;
enum enum_i_s_events_fields
{
ISE_EVENT_CATALOG= 0,
......@@ -7556,6 +7569,60 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
DBUG_RETURN(res);
}
int add_symbol_to_table(const char* name, TABLE* table){
DBUG_ENTER("add_symbol_to_table");
uint length= strlen(name);
// If you've added a new SQL keyword longer than KEYWORD_SIZE,
// please increase the defined max length
DBUG_ASSERT(length < KEYWORD_SIZE);
restore_record(table, s->default_values);
table->field[0]->set_notnull();
table->field[0]->store(name, length,
system_charset_info);
if (schema_table_store_record(table->in_use, table))
DBUG_RETURN(1);
DBUG_RETURN(0);
}
int fill_i_s_keywords(THD *thd, TABLE_LIST *tables, COND *cond)
{
DBUG_ENTER("fill_i_s_keywords");
TABLE *table= tables->table;
for (uint i= 0; i < symbols_length; i++){
const char *name= symbols[i].name;
if (add_symbol_to_table(name, table))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
int fill_i_s_sql_functions(THD *thd, TABLE_LIST *tables, COND *cond) {
DBUG_ENTER("fill_i_s_sql_functions");
TABLE *table= tables->table;
for (uint i= 0; i < sql_functions_length; i++){
const char *name= sql_functions[i].name;
if (add_symbol_to_table(name, table))
DBUG_RETURN(1);
}
for (uint i= 0; i < func_array_length; i++){
const char *name= func_array[i].name.str;
if (add_symbol_to_table(name, table))
DBUG_RETURN(1);
}
DBUG_RETURN(0);
}
int fill_status(THD *thd, TABLE_LIST *tables, COND *cond)
{
......@@ -8763,6 +8830,18 @@ ST_FIELD_INFO enabled_roles_fields_info[]=
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
ST_FIELD_INFO keywords_field_info[]=
{
{"WORD", KEYWORD_SIZE, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
ST_FIELD_INFO sql_functions_field_info[]=
{
{"FUNCTION", KEYWORD_SIZE, MYSQL_TYPE_STRING, 0, MY_I_S_MAYBE_NULL, 0, SKIP_OPEN_TABLE},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE}
};
ST_FIELD_INFO engines_fields_info[]=
{
......@@ -9465,6 +9544,8 @@ ST_SCHEMA_TABLE schema_tables[]=
fill_status, make_old_format, 0, 0, -1, 0, 0},
{"GLOBAL_VARIABLES", variables_fields_info, 0,
fill_variables, make_old_format, 0, 0, -1, 0, 0},
{"KEYWORDS", keywords_field_info, 0,
fill_i_s_keywords, 0, 0, -1, -1, 0, 0},
{"KEY_CACHES", keycache_fields_info, 0,
fill_key_cache_tables, 0, 0, -1,-1, 0, 0},
{"KEY_COLUMN_USAGE", key_column_usage_fields_info, 0,
......@@ -9500,6 +9581,8 @@ ST_SCHEMA_TABLE schema_tables[]=
{"STATISTICS", stat_fields_info, 0,
get_all_tables, make_old_format, get_schema_stat_record, 1, 2, 0,
OPEN_TABLE_ONLY|OPTIMIZE_I_S_TABLE},
{"SQL_FUNCTIONS", sql_functions_field_info, 0,
fill_i_s_sql_functions, 0, 0, -1, -1, 0, 0},
{"SYSTEM_VARIABLES", sysvars_fields_info, 0,
fill_sysvars, make_old_format, 0, 0, -1, 0, 0},
{"TABLES", tables_fields_info, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment