1 /* $NetBSD: vi_db.h,v 1.3 2013/11/29 22:56:19 christos Exp $ */
5 #ifndef DB_BUFFER_SMALL
6 #define DB_BUFFER_SMALL ENOMEM
13 typedef recno_t db_recno_t
;
14 #define DB_MAX_RECORDS MAX_REC_NUMBER
16 #define db_env_close(env,flags)
17 #define db_env_create(env,flags) \
19 #define db_env_remove(env,path,flags) \
21 #define db_open(db,file,type,flags,mode) \
22 (db)->open(db, file, NULL, type, flags, mode)
23 #define db_get_low(db,key,data,flags) \
24 (db)->get(db, key, data, flags)
25 #define db_close(db) \
30 #if USE_DB1 || (DB_VERSION_MAJOR >= 3 && DB_VERSION_MINOR >= 1)
31 #define db_env_open(env,path,flags,mode) \
32 (env)->open(env, path, flags, mode)
33 #define db_env_remove(env,path,flags) \
34 (env)->remove(env, path, flags)
36 #define db_env_open(env,path,flags,mode) \
37 (env)->open(env, path, NULL, flags, mode)
38 #define db_env_remove(env,path,flags) \
39 (env)->remove(env, path, NULL, flags)
42 #define db_env_close(env,flags) \
43 (env)->close(env, flags)
45 #if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 1
46 #define db_open(db,file,type,flags,mode) \
47 (db)->open(db, NULL, file, NULL, type, flags, mode)
49 #define db_open(db,file,type,flags,mode) \
50 (db)->open(db, file, NULL, type, flags, mode)
52 #define db_get_low(db,key,data,flags) \
53 (db)->get(db, NULL, key, data, flags)
54 #define db_close(db) \
55 (db)->close(db, DB_NOSYNC)
59 #ifdef USE_DYNAMIC_LOADING
60 #define db_create nvi_db_create
61 #define db_env_create nvi_db_env_create
62 #define db_strerror nvi_db_strerror
64 extern int (*nvi_db_create
) __P((DB
**, DB_ENV
*, u_int32_t
));
65 extern int (*nvi_db_env_create
) __P((DB_ENV
**, u_int32_t
));
66 extern char *(*nvi_db_strerror
) __P((int));
78 #define DB_NOTFOUND (-30989)
91 #define DB_DBT_USERMEM 0x040
95 /* DB_ENV emulation */
97 typedef struct __db_env_new DB_ENV
;
100 int (*close
)(DB_ENV
*, u_int32_t
);
101 int (*open
)(DB_ENV
*, char *, u_int32_t
, int);
102 #define DB_INIT_MPOOL 0x004000
103 #define DB_PRIVATE 0x200000
104 int (*remove
)(DB_ENV
*, char *, u_int32_t
);
113 typedef struct __dbc_new DBC
;
115 typedef recno_t db_recno_t
;
116 #define DB_MAX_RECORDS MAX_REC_NUMBER
118 #define DB_UNKNOWN (-1)
124 typedef struct __db_new DB
;
139 int (*close
)(DB
*, u_int32_t
);
140 #define DB_NOSYNC 26 /* close() */
142 int (*open
)(DB
*, const char *, const char *, DBTYPE
, u_int32_t
, int);
143 #define DB_CREATE 0x000001 /* Create file as necessary. */
144 #define DB_TRUNCATE 0x004000 /* Discard existing DB (O_TRUNC) */
146 int (*sync
)(DB
*, u_int32_t
);
147 int (*get
)(DB
*, DB_TXN
*, DBT
*, DBT
*, u_int32_t
);
148 int (*put
)(DB
*, DB_TXN
*, DBT
*, DBT
*, u_int32_t
);
149 int (*del
)(DB
*, DB_TXN
*, DBT
*, u_int32_t
);
151 int (*cursor
)(DB
*, DB_TXN
*, DBC
**, u_int32_t
);
153 int (*set_flags
)(DB
*, u_int32_t
);
154 #define DB_RENUMBER 0x0008 /* Recno: renumber on insert/delete. */
155 #define DB_SNAPSHOT 0x0020 /* Recno: snapshot the input. */
157 int (*set_pagesize
)(DB
*, u_int32_t
);
159 int (*set_re_delim
)(DB
*, int);
160 int (*set_re_source
)(DB
*, const char *);
162 RECNOINFO _recno_info
;
171 int (*c_close
)(DBC
*);
172 int (*c_get
)(DBC
*, DBT
*, DBT
*, u_int32_t
);
173 int (*c_put
)(DBC
*, DBT
*, DBT
*, u_int32_t
);