1 /* $NetBSD: db.h,v 1.2 2008/05/20 17:53:18 aymeric Exp $ */
5 #ifndef DB_BUFFER_SMALL
6 #define DB_BUFFER_SMALL ENOMEM
9 #if USE_DB1 || (DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1)
10 #define db_env_open(env,path,flags,mode) \
11 (env)->open(env, path, flags, mode)
12 #define db_env_remove(env,path,flags) \
13 (env)->remove(env, path, flags)
15 #define db_env_open(env,path,flags,mode) \
16 (env)->open(env, path, NULL, flags, mode)
17 #define db_env_remove(env,path,flags) \
18 (env)->remove(env, path, NULL, flags)
21 #if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
22 #define db_open(db,file,type,flags,mode) \
23 (db)->open(db, NULL, file, NULL, type, flags, mode)
25 #define db_open(db,file,type,flags,mode) \
26 (db)->open(db, file, NULL, type, flags, mode)
29 #ifdef USE_DYNAMIC_LOADING
30 #define db_create nvi_db_create
31 #define db_env_create nvi_db_env_create
32 #define db_strerror nvi_db_strerror
34 extern int (*nvi_db_create
) __P((DB
**, DB_ENV
*, u_int32_t
));
35 extern int (*nvi_db_env_create
) __P((DB_ENV
**, u_int32_t
));
36 extern char *(*nvi_db_strerror
) __P((int));
48 #define DB_NOTFOUND (-30989)
61 #define DB_DBT_USERMEM 0x040
65 /* DB_ENV emulation */
67 typedef struct __db_env_new DB_ENV
;
70 int (*close
)(DB_ENV
*, u_int32_t
);
71 int (*open
)(DB_ENV
*, char *, u_int32_t
, int);
72 #define DB_INIT_MPOOL 0x004000
73 #define DB_PRIVATE 0x200000
74 int (*remove
)(DB_ENV
*, char *, u_int32_t
);
83 typedef struct __dbc_new DBC
;
85 typedef recno_t db_recno_t
;
86 #define DB_MAX_RECORDS MAX_REC_NUMBER
88 #define DB_UNKNOWN (-1)
94 typedef struct __db_new DB
;
109 int (*close
)(DB
*, u_int32_t
);
110 #define DB_NOSYNC 26 /* close() */
112 int (*open
)(DB
*, const char *, const char *, DBTYPE
, u_int32_t
, int);
113 #define DB_CREATE 0x000001 /* Create file as necessary. */
114 #define DB_TRUNCATE 0x004000 /* Discard existing DB (O_TRUNC) */
116 int (*sync
)(DB
*, u_int32_t
);
117 int (*get
)(DB
*, DB_TXN
*, DBT
*, DBT
*, u_int32_t
);
118 int (*put
)(DB
*, DB_TXN
*, DBT
*, DBT
*, u_int32_t
);
119 int (*del
)(DB
*, DB_TXN
*, DBT
*, u_int32_t
);
121 int (*cursor
)(DB
*, DB_TXN
*, DBC
**, u_int32_t
);
123 int (*set_flags
)(DB
*, u_int32_t
);
124 #define DB_RENUMBER 0x0008 /* Recno: renumber on insert/delete. */
125 #define DB_SNAPSHOT 0x0020 /* Recno: snapshot the input. */
127 int (*set_pagesize
)(DB
*, u_int32_t
);
129 int (*set_re_delim
)(DB
*, int);
130 int (*set_re_source
)(DB
*, const char *);
132 RECNOINFO _recno_info
;
141 int (*c_close
)(DBC
*);
142 int (*c_get
)(DBC
*, DBT
*, DBT
*, u_int32_t
);
143 int (*c_put
)(DBC
*, DBT
*, DBT
*, u_int32_t
);