dbcheck.h

来自「db.* (pronounced dee-be star) is an adva」· C头文件 代码 · 共 464 行 · 第 1/2 页

H
464
字号
/*************************************************************************** *                                                                         * * db.*                                                                    * * open source database, dbcheck utility                                   * *                                                                         * * Copyright (c) 2000 Centura Software Corporation. All rights reserved.   * *                                                                         * * Use of this software, whether in source code format, or in executable,  * * binary object code form, is governed by the CENTURA OPEN SOURCE LICENSE * * which is fully described in the LICENSE.TXT file, included within this  * * distribution of source code files.                                      *  *                                                                         * **************************************************************************//* node number of root */#define ROOT_ADDR 1L/* null node pointer */#define NULL_NODE ((F_ADDR)-1)/* record with problems */#define BAD_REC   (char *)1#define BAD_STMP  (char *)1/* make strings plural */#define PLURAL(n, s, p)  ((n == 1) ? s : p)#define PLULET(n)        PLURAL(n, DB_TEXT(""), DB_TEXT("s"))/* offsets into record slots */#define REC_RID      0#define REC_DBA      (REC_RID + sizeof(short))#define REC_STMP     (REC_DBA + sizeof(long))#define REC_KEY(ts)  (REC_STMP + ((ts) ? 2*sizeof(long) : 0))/* offsets into nodes */#define NODE_TS      0#define NODE_SLCNT   (NODE_TS + sizeof(long))#define NODE_SLOTS   (NODE_SLCNT + sizeof(short))/* offsets into key slots */#define SLOT_CHILD   0#define SLOT_KEYNO   (SLOT_CHILD + sizeof(F_ADDR))#define SLOT_KEY     (SLOT_KEYNO + sizeof(short))#define SLOT_DBA(kl) (SLOT_KEY + kl)/* locate bits in long bit masks */#define BITS_TO_BYTES(bits) (((bits) - 1) / BITS_PER_BYTE + 1)#define BYTE_NO(bit)        ((bit) / BITS_PER_BYTE)#define BIT_NO(bit)         ((bit) % BITS_PER_BYTE)/* dbcheck command line arguments / options */typedef struct _CHKOPTS{    DB_BOOLEAN     setscan;    DB_BOOLEAN     keyscan;    DB_BOOLEAN     datkey;    DB_BOOLEAN     keydat;    DB_BOOLEAN     timestmp;    DB_BOOLEAN     ignorekey;    short          report;    short          numpages;    short          numfiles;    DB_BOOLEAN     treetrace;    DB_BOOLEAN     counts;    DB_TCHAR      *dbname;              /* database name */    DB_TCHAR     **fnames;              /* list of file names to check */    short          nfnames;             /* number of files in list */    SG            *sg;}  CHKOPTS;/* set number and offset information */typedef struct _SET_INFO{    short    setno;                  /* The number of the set             */    short    setoff;                 /* The offset of the set information */    short    sbfoff;                 /* The offset of the cached set      */    short    ownrid;                 /* The record id of the set owner    */    short    memoff;                 /* The offset of the member info     */    short    mbfoff;                 /* The offset of the cached member   */    DB_BOOLEAN  stampd;              /* Whether the set is timestamped    */}  SET_INFO;/* record's set information */typedef struct _REC_SET_INFO{    short    cnt;                    /* Count of sets for record type */    short    byt;                    /* Number of bytes to represent sets */    SET_INFO   *lst;                 /* List of sets for record type  */}  REC_SET_INFO;/* record's key information */typedef struct _REC_KEY_INFO{    short    cnt;                    /* Count of keys for record type     */    short    byt;                    /* Number of bytes to represent keys */    short   *lst;                    /* List of key fields for record     */}  REC_KEY_INFO;/* set pointers */typedef struct _SET{    long        members;    DB_ADDR     first;    DB_ADDR     last;}  SET;/* member pointers */typedef struct _MEMBER{    DB_ADDR     owner;    DB_ADDR     prev;    DB_ADDR     next;}  MEMBER;/* record check information */typedef struct _CHKREC{    short       dba_msg,                del_msg,                lock_msg,                rid_msg,                idba_msg;    DB_BOOLEAN  force;    char       *pgptr;    short       rid;    DB_BOOLEAN  del,                lck;    DB_BOOLEAN  good;}  CHKREC;/* record header information */typedef struct _RECINFO{    short       rid;    DB_BOOLEAN  del,                lck;}  RECINFO;/* slot information */typedef struct _SLINFO{    short       levl;    NODE       *node;    char       *sl_addr;    short       slot;    DB_BOOLEAN  last;    DB_BOOLEAN  all_null;    F_ADDR      child;    short       keyno;    short       keyfd;    short       keyln;    DB_ADDR     dba;    FIELD_ENTRY *kf_ptr;}  SLINFO;/* information about current file / slot for error reporting */typedef struct _ERRINFO{    FILE_NO fno;    F_ADDR  addr;    F_ADDR  err_addr;    long    tot_rec_err;    long    tot_err_cnt;}  ERRINFO;/* database structure information */typedef struct _DBINFO{    short         num_recs;             /* Number of elements in 3 arrays */    REC_SET_INFO *owners;               /* 3 arrays, by record type, giving */    REC_SET_INFO *members;              /* sets owned by and owning record, */    REC_KEY_INFO *keys;                 /* and key fields in it             */    short         num_keys;             /* Number of key fields in database */    short        *key_fld;              /* 2 arrays, by key prefix, giving  */    short        *key_len;              /* field table index and key length */    F_ADDR       *rec_cnt;              /* Count of record instances checked */    F_ADDR       *set_cnt;              /* Count of set members checked */    F_ADDR       *key_cnt;              /* Count of key slots checked */    F_ADDR       *tops;                 /* Nextslot values from each file */    long          num_del;              /* Deleted slots / nodes, current file */    PAGE_CACHE   *pcache;               /* Cache for dchain & key use bitmaps */    CHKOPTS      *opts;                 /* Command line args / options */    ERRINFO      *errinfo;              /* Number of errors in database */}  DBINFO;/* page cache information */typedef struct _BTCACHE{    F_ADDR      addr;                         /* The file address */    char       *pgbuf;                        /* The page data    */}  BTCACHE;/* error information structures */typedef struct _ERR_PDBA{    short       setno;    DB_ADDR     dba;}  ERR_PDBA;typedef struct _ERR_STYP{    short       setno;    DB_ADDR     dba;    short       rid;}  ERR_STYP;typedef struct _ERR_SCNT{    short       setno;    F_ADDR      owncnt;    F_ADDR      memcnt;}  ERR_SCNT;typedef struct _ERR_LEVL{    short       levl;    short       mlvl;}  ERR_LEVL;typedef struct _ERR_PGZERO{    short       file;    DB_ULONG    slot;}  ERR_PGZERO;typedef struct _ERR_KEYDUPES{

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?