typedef struct dict_table_struct    dict_table_t;

/** Data structure for a database table.  Most fields will be
initialized to 0, NULL or FALSE in dict_mem_table_create(). */
struct dict_table_struct{
    table_id_t    id;    /*!< id of the table */
    mem_heap_t*    heap;    /*!< memory heap */
    char*        name;    /*!< table name */
    const char*    dir_path_of_temp_table;/*!< NULL or the directory path
                where a TEMPORARY table that was explicitly
                created by a user should be placed if
                innodb_file_per_table is defined in my.cnf;
                in Unix this is usually /tmp/..., in Windows
                temp\... */
    unsigned    space:;
                /*!< space where the clustered index of the
                table is placed */
    unsigned    flags:DICT_TF2_BITS;/*!< DICT_TF_COMPACT, ... */
    unsigned    ibd_file_missing:;
                /*!< TRUE if this is in a single-table
                tablespace and the .ibd file is missing; then
                we must return in ha_innodb.cc an error if the
                user tries to query such an orphaned table */
    unsigned    tablespace_discarded:;
                /*!< this flag is set TRUE when the user
                calls DISCARD TABLESPACE on this
                table, and reset to FALSE in IMPORT
                TABLESPACE */
    unsigned    cached:;/*!< TRUE if the table object has been added
                to the dictionary cache */
    unsigned    n_def:;/*!< number of columns defined so far */
    unsigned    n_cols:;/*!< number of columns */
    unsigned    corrupted:;
                /*!< TRUE if table is corrupted */
    dict_col_t*    cols;    /*!< array of column descriptions */
    const char*    col_names;
                /*!< Column names packed in a character string
                "name1\0name2\0...nameN\0".  Until
                the string contains n_cols, it will be
                allocated from a temporary heap.  The final
                string will be allocated from table->heap. */
#ifndef UNIV_HOTBACKUP
    hash_node_t    name_hash; /*!< hash chain node */
    hash_node_t    id_hash; /*!< hash chain node */
    UT_LIST_BASE_NODE_T(dict_index_t)
            indexes; /*!< list of indexes of the table */
    UT_LIST_BASE_NODE_T(dict_foreign_t)
            foreign_list;/*!< list of foreign key constraints
                in the table; these refer to columns
                in other tables */
    UT_LIST_BASE_NODE_T(dict_foreign_t)
            referenced_list;/*!< list of foreign key constraints
                which refer to this table */

    ib_rbt_t*    foreign_rbt;    /*!< a rb-tree of all foreign keys
                    listed in foreign_list, sorted by
                    foreign->id */
    ib_rbt_t*    referenced_rbt;    /*!< a rb-tree of all foreign keys
                    listed in referenced_list, sorted by
                    foreign->id */

    UT_LIST_NODE_T(dict_table_t)
            table_LRU; /*!< node of the LRU list of tables */
    ulint        n_mysql_handles_opened;
                /*!< count of how many handles MySQL has opened
                to this table; dropping of the table is
                NOT allowed until this count gets to zero;
                MySQL does NOT itself check the number of
                open handles at drop */
    unsigned    fk_max_recusive_level:;
                /*!< maximum recursive level we support when
                loading tables chained together with FK
                constraints. If exceeds this level, we will
                stop loading child table into memory along with
                its parent table */
    ulint        n_foreign_key_checks_running;
                /*!< count of how many foreign key check
                operations are currently being performed
                on the table: we cannot drop the table while
                there are foreign key checks running on
                it! */
    trx_id_t    query_cache_inv_trx_id;
                /*!< transactions whose trx id is
                smaller than this number are not
                allowed to store to the MySQL query
                cache or retrieve from it; when a trx
                with undo logs commits, it sets this
                to the value of the trx id counter for
                the tables it had an IX lock on */
    UT_LIST_BASE_NODE_T(lock_t)
            locks; /*!< list of locks on the table */
#ifdef UNIV_DEBUG
    /*----------------------*/
    ibool        does_not_fit_in_memory;
                /*!< this field is used to specify in
                simulations tables which are so big
                that disk should be accessed: disk
                access is simulated by putting the
                thread to sleep for a while; NOTE that
                this flag is not stored to the data
                dictionary on disk, and the database
                will forget about value TRUE if it has
                to reload the table definition from
                disk */
#endif /* UNIV_DEBUG */
    /*----------------------*/
    unsigned    big_rows:;
                /*!< flag: TRUE if the maximum length of
                a single row exceeds BIG_ROW_SIZE;
                initialized in dict_table_add_to_cache() */
                /** Statistics for query optimization.
                The following stat_* members are usually
                protected by dict_table_stats_lock(). In
                some exceptional cases (performance critical
                code paths) we access or modify stat_n_rows
                and stat_modified_counter without any
                protection. */
                /* @{ */
    unsigned    stat_initialized:; /*!< TRUE if statistics have
                been calculated the first time
                after database startup or table creation */
    ib_int64_t    stat_n_rows;
                /*!< approximate number of rows in the table;
                we periodically calculate new estimates */
    ulint        stat_clustered_index_size;
                /*!< approximate clustered index size in
                database pages */
    ulint        stat_sum_of_other_index_sizes;
                /*!< other indexes in database pages */
    ulint        stat_modified_counter;
                /*!< when a row is inserted, updated,
                or deleted,
                we add 1 to this number; we calculate new
                estimates for the stat_... values for the
                table and the indexes at an interval of 2 GB
                or when about 1 / 16 of table has been
                modified; also when the estimate operation is
                called for MySQL SHOW TABLE STATUS; the
                counter is reset to zero at statistics
                calculation; this counter is not protected by
                any latch, because this is only used for
                heuristics */
                /* @} */
    /*----------------------*/
                /**!< The following fields are used by the
                AUTOINC code.  The actual collection of
                tables locked during AUTOINC read/write is
                kept in trx_t. In order to quickly determine
                whether a transaction has locked the AUTOINC
                lock we keep a pointer to the transaction
                here in the autoinc_trx variable. This is to
                avoid acquiring the kernel mutex and scanning
                the vector in trx_t.

                When an AUTOINC lock has to wait, the
                corresponding lock instance is created on
                the trx lock heap rather than use the
                pre-allocated instance in autoinc_lock below.*/
                /* @{ */
    lock_t*        autoinc_lock;
                /*!< a buffer for an AUTOINC lock
                for this table: we allocate the memory here
                so that individual transactions can get it
                and release it without a need to allocate
                space from the lock heap of the trx:
                otherwise the lock heap would grow rapidly
                if we do a large insert from a select */
    mutex_t        autoinc_mutex;
                /*!< mutex protecting the autoincrement
                counter */
    ib_uint64_t    autoinc;/*!< autoinc counter value to give to the
                next inserted row */
    ulong        n_waiting_or_granted_auto_inc_locks;
                /*!< This counter is used to track the number
                of granted and pending autoinc locks on this
                table. This value is set after acquiring the
                kernel mutex but we peek the contents to
                determine whether other transactions have
                acquired the AUTOINC lock or not. Of course
                only one transaction can be granted the
                lock but there can be multiple waiters. */
    const trx_t*        autoinc_trx;
                /*!< The transaction that currently holds the
                the AUTOINC lock on this table. */
                /* @} */
    /*----------------------*/
#endif /* !UNIV_HOTBACKUP */

#ifdef UNIV_DEBUG
    ulint        magic_n;/*!< magic number */
/** Value of dict_table_struct::magic_n */
# define DICT_TABLE_MAGIC_N
#endif /* UNIV_DEBUG */
};

结构体dict_table_t的更多相关文章

  1. Go结构体实现类似成员函数机制

    Go语言结构体成员能否是函数,从而实现类似类的成员函数的机制呢?答案是肯定的. package main import "fmt" type stru struct { testf ...

  2. C#基础回顾(二)—页面值传递、重载与重写、类与结构体、装箱与拆箱

    一.前言 -孤独的路上有梦想作伴,乘风破浪- 二.页面值传递 (1)C#各页面之间可以进行数据的交换和传递,页面之间可根据获取的数据,进行各自的操作(跳转.计算等操作).为了实现多种方式的数据传递,C ...

  3. go语言结构体

    定义: 是一种聚合的数据类型,是由零个或多个任意类型的值聚合成的实体. 成员: 每个值称为结构体的成员. 示例: 用结构体的经典案例处理公司的员工信息,每个员工信息包含一个唯一的员工编号.员工的名字. ...

  4. C语言中的结构体

    用户自己建立自己的结构体类型 1.  定义和使用结构体变量 (1).结构体的定义 C语言允许用户自己建立由不同类型数据组成的组合型的数据结构,它称为结构体. (2).声明一个结构体类型的一般形式为: ...

  5. C++_系列自学课程_第_12_课_结构体

    #include <iostream> #include <string> using namespace std; struct CDAccount { double bal ...

  6. java socket传送一个结构体给用C++编写的服务器解析的问题

    另一端是Java写客户端程序,两者之间需要通信.c++/c接收和发送的都是结构体,而Java是直接发送的字节流或者byte 数组.解决方法:c++/c socket 在发送结构体的时候其实发送的也是字 ...

  7. swift学习笔记3——类、结构体、枚举

    之前学习swift时的个人笔记,根据github:the-swift-programming-language-in-chinese学习.总结,将重要的内容提取,加以理解后整理为学习笔记,方便以后查询 ...

  8. HDOJ 1009. Fat Mouse' Trade 贪心 结构体排序

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  9. C语言结构体对齐

    1.结构体变量中的元素如何访问? (1)数组中元素的访问方式:表面上有2种方式(数组下标方式和指针方式):实质上都是指针方式访问.(2)结构体变量中的元素访问方式:只有一种,用.或者->的方式来 ...

随机推荐

  1. QT宏 Q_OBJECT,explicit, QHostAddress, quint, emit

    QT相關 一. 參考: 1.宏Q_OBJECT 二. explicit struct constrcution 三. QHostAddress Detailed Description: The QH ...

  2. 基本上,把switch,用设计模式代替,肯定是bug和过度设计。想想,本来修改一个文件几行代码可以解决的问题,变成修改3-6个类才能实现一样的功能。不是傻是什么?

    那些迷信设计模式的人,来修改一下这个方法吧.看看你最终的代码膨胀为几倍... public virtual PasswordChangeResult ChangePassword(ChangePass ...

  3. 各种OS间文件传输

    搞了几天才会这个法子,羞愧难当. Ubuntu安装iptux,windows下是飞鸽传输.同局域网下可以聊天,传送文件或文件夹.文件夹速度大概10M/S. 其他共享方法: ftp服务器,不成功 sam ...

  4. 用C#开发一个WinForm版的批量图片压缩工具

    我们在实际项目开发过程中,曾经遇到过一个需求,就是要开发一个对大量图片进行整理(删除掉一些不符合要求的图片).归类(根据格式进行分类,比如jpg格式.bmp格式等).压缩(因为有的图片很大很占空间,看 ...

  5. TeeChart 的应用

    TeeChart 是一个很棒的绘图控件,不过由于里面没有注释,网上相关的资料也很少,所以在应用的时候只能是一点点的试.为了防止以后用到的时候忘记,我就把自己用到的东西都记录下来,以便以后使用的时候查询 ...

  6. 关于WPF中Popup控件的小记

    在wpf开发中,常需要在鼠标位置处弹出一个“提示框”(在此就以“提示框”代替吧),通过“提示框”进行信息提示或者数据操作,如果仅仅是提示作用,使用ToolTip控件已经足够,但是有些是需要在弹出的框中 ...

  7. spring data mongodb中,如果对象中的属性不想加入到数据库字段中

    spring data mongodb中,如果对象中的属性不想加入到数据库字段中,可加@Transient注解,声明为透明属性 spring data mongodb 官网帮助文档 http://ww ...

  8. 《Effective Java》读书笔记

    一.引言 1.几条基本规则:(清晰性和简洁性最为重要) 模块的用户永远也不应该被模块的行为所迷惑(那样就不清晰了),模块要尽可能小,但又不能太小 代码应该被重用,而不是被拷贝 模块之间的依赖性应该尽可 ...

  9. about家庭智能设备部分硬件模块功能共享【协同工作】solution

    本人设备列表: Onda tablet {Android} wifi Desktop computer {win7.centos7} 外接蓝牙adapter PS interface 键盘.鼠标{与同 ...

  10. Android初步 简单demo

    刚入门不久,没学JAVA,从C++转过来的,C++的QT和安卓简直有异曲同工之妙,为了加深自己对安卓的理解,特写博客以记录,望大神们多多指点. 效果图,刚入门的话,肯定要熟悉基本的控件的使用,这跟我学 ...