tailieunhanh - MySQL Administrator’s Bible- P16

MySQL Administrator’s Bible- P16: Welcome to the MySQL Administrator’s Bible. Like all books in the Bible series, you can expect to find both hands-on tutorials and real-world practical application information, as well as reference and background information that provide a context for what you are learning. | The MySQL Data Dictionary 21 is not in the source package but it is in the mysql-devel package the compilation process creates later on . Unfortunately is only in the source package not the mysql-devel package so you need to download both the source and the mysql-devel packages. On an abstract level making a custom system view in the INFORMATION_SCHEMA database requires The field definitions of the system view that is the structure of the system view . In our example we define a system view named MYSQL_HELLO with a field defined as HELLO VARCHAR 64 NOT NULL DEFAULT . The function that populates the system view upon request that is the values in the system view . We will define a function to store the string plugin hello information_schema into the HELLO field of our MYSQL_HELLO system view. On a more technical level to create the custom system view you need to instantiate the ST_SCHEMA_TABLE struct and define two members. One member field_info is an array of ST_FIELD_INFO structures which define the fields in your system view. The values in the ST_FIELD_INFO structure are defined in the source code in the sql header file and explained in Table 21-3. ST_FIELD_INFO Structure TABLE 21-3 Code Explanation Example Value const char field_name Field name HELLO uint field_length In string-type fields the maximum number of characters. In other fields the display length. 64 in our example a string-type field enum enum_field_types field_type Field data type MYSQL_TYPE_VARCHAR int value Field value 0 uint field_flags 0 means NOT NULL and SIGNED. It can be overridden by MY_I_S_MAYBE_NULL MY_I_S_UNSIGNED or both constants separated by bitwise or . 0 const char old_name Old field name Hello uint open_method How the table is opened. One of SKIP_OPEN_TABLE OPEN_FRM_ONLY or OPEN_FULL_TABLE. SKIP_OPEN_TABLE 717 Part IV Extending Your Skills Our example contains the following code to define the custom system view 8. static .

TỪ KHÓA LIÊN QUAN