db185_int.h
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:5k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /*-
  2.  * See the file LICENSE for redistribution information.
  3.  *
  4.  * Copyright (c) 1997, 1998, 1999, 2000
  5.  * Sleepycat Software.  All rights reserved.
  6.  */
  7. /*
  8.  * Copyright (c) 1990, 1993, 1994, 1995, 1996
  9.  * Keith Bostic.  All rights reserved.
  10.  */
  11. /*
  12.  * Copyright (c) 1990, 1993, 1994
  13.  * The Regents of the University of California.  All rights reserved.
  14.  *
  15.  * Redistribution and use in source and binary forms, with or without
  16.  * modification, are permitted provided that the following conditions
  17.  * are met:
  18.  * 1. Redistributions of source code must retain the above copyright
  19.  *    notice, this list of conditions and the following disclaimer.
  20.  * 2. Redistributions in binary form must reproduce the above copyright
  21.  *    notice, this list of conditions and the following disclaimer in the
  22.  *    documentation and/or other materials provided with the distribution.
  23.  * 3. Neither the name of the University nor the names of its contributors
  24.  *    may be used to endorse or promote products derived from this software
  25.  *    without specific prior written permission.
  26.  *
  27.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  28.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  29.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  30.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  31.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  32.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  33.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  34.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  35.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  36.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  37.  * SUCH DAMAGE.
  38.  *
  39.  * $Id: db185_int.h,v 11.7 2001/01/22 22:22:46 krinsky Exp $
  40.  */
  41. #ifndef _DB185_H_
  42. #define _DB185_H_
  43. /* Routine flags. */
  44. #define R_CURSOR 1 /* del, put, seq */
  45. #define __R_UNUSED 2 /* UNUSED */
  46. #define R_FIRST 3 /* seq */
  47. #define R_IAFTER 4 /* put (RECNO) */
  48. #define R_IBEFORE 5 /* put (RECNO) */
  49. #define R_LAST 6 /* seq (BTREE, RECNO) */
  50. #define R_NEXT 7 /* seq */
  51. #define R_NOOVERWRITE 8 /* put */
  52. #define R_PREV 9 /* seq (BTREE, RECNO) */
  53. #define R_SETCURSOR 10 /* put (RECNO) */
  54. #define R_RECNOSYNC 11 /* sync (RECNO) */
  55. typedef struct {
  56. void *data; /* data */
  57. size_t  size; /* data length */
  58. } DBT185;
  59. /* Access method description structure. */
  60. typedef struct __db185 {
  61. DBTYPE type; /* Underlying db type. */
  62. int (*close) __P((struct __db185 *));
  63. int (*del) __P((const struct __db185 *, const DBT185 *, u_int));
  64. int (*get)
  65.     __P((const struct __db185 *, const DBT185 *, DBT185 *, u_int));
  66. int (*put)
  67.     __P((const struct __db185 *, DBT185 *, const DBT185 *, u_int));
  68. int (*seq)
  69.     __P((const struct __db185 *, DBT185 *, DBT185 *, u_int));
  70. int (*sync) __P((const struct __db185 *, u_int));
  71. DB   *dbp; /* DB structure.  Was void *internal. */
  72. int (*fd) __P((const struct __db185 *));
  73. /*
  74.  * !!!
  75.  * The following elements added to the end of the DB 1.85 DB
  76.  * structure.
  77.  */
  78. DBC   *dbc; /* DB cursor. */
  79. /* Various callback functions. */
  80. int   (*compare) __P((const DBT *, const DBT *));
  81. size_t   (*prefix) __P((const DBT *, const DBT *));
  82. u_int32_t (*hash) __P((const void *, size_t));
  83. } DB185;
  84. /* Structure used to pass parameters to the btree routines. */
  85. typedef struct {
  86. #define R_DUP 0x01 /* duplicate keys */
  87. u_int32_t flags;
  88. u_int32_t cachesize; /* bytes to cache */
  89. u_int32_t maxkeypage; /* maximum keys per page */
  90. u_int32_t minkeypage; /* minimum keys per page */
  91. u_int32_t psize; /* page size */
  92. int (*compare) /* comparison function */
  93.     __P((const DBT *, const DBT *));
  94. size_t (*prefix) /* prefix function */
  95.     __P((const DBT *, const DBT *));
  96. int lorder; /* byte order */
  97. } BTREEINFO;
  98. /* Structure used to pass parameters to the hashing routines. */
  99. typedef struct {
  100. u_int32_t bsize; /* bucket size */
  101. u_int32_t ffactor; /* fill factor */
  102. u_int32_t nelem; /* number of elements */
  103. u_int32_t cachesize; /* bytes to cache */
  104. u_int32_t /* hash function */
  105. (*hash) __P((const void *, size_t));
  106. int lorder; /* byte order */
  107. } HASHINFO;
  108. /* Structure used to pass parameters to the record routines. */
  109. typedef struct {
  110. #define R_FIXEDLEN 0x01 /* fixed-length records */
  111. #define R_NOKEY 0x02 /* key not required */
  112. #define R_SNAPSHOT 0x04 /* snapshot the input */
  113. u_int32_t flags;
  114. u_int32_t cachesize; /* bytes to cache */
  115. u_int32_t psize; /* page size */
  116. int lorder; /* byte order */
  117. size_t reclen; /* record length (fixed-length records) */
  118. u_char bval; /* delimiting byte (variable-length records */
  119. char *bfname; /* btree file name */
  120. } RECNOINFO;
  121. #endif /* !_DB185_H_ */