MySQL:如何编写Information Schema Plugin(2)
2)初始化I_S插件
函数原型:name_init(void *p)
函数用于初始化插件,包括指定表的模式、创建表、构造表的函数指针等信息,指针p会指向一个结构体st_schema_table,如下表:
字段 |
类型 |
描述 |
table_name |
const char* |
mysql会自动对表赋予插件名,因此我们无需直接赋值 |
fields_info |
ST_FIELD_INFO * |
ST_FIELD_INFO类型的结构体数组,用于存储表的每一列的信息,如列名及类型等 |
create_table |
TABLE *(*create_table) (THD *thd, TABLE_LIST *table_list); |
函数指针,用来创建TABLE结构体,所有的i_s表基本一致,mysql会自动赋值 |
fill_table |
int (*fill_table) (THD *thd, TABLE_LIST *tables, COND *cond); |
函数指针,用于向表中填充记录 |
old_format |
int (*old_format) (THD *thd, struct st_schema_table *schema_table); |
用于支持内建i_s表的show功能,无需关注 |
process_table |
int (*process_table) ( THD *thd, TABLE_LIST *tables, TABLE *table, bool res, LEX_STRING *db_name, LEX_STRING *table_name); |
仅用于内建i_s表 |
idx_field1, idx_field2 |
int |
仅用于内建i_s表 |
hidden |
bool |
如果为true,则其中的数据只能通过show展现,由于i_s Plugin不支持show,无需关心此变量 |
i_s_requested_object |
uint |
仅用于内建i_s表 |
相关新闻>>
- 发表评论
-
- 最新评论 进入详细评论页>>