d9898ee8 |
1 | /* |
2 | ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for |
3 | ** distribution information. |
4 | */ |
5 | |
b0322a85 |
6 | #include "config.h" |
d9898ee8 |
7 | #include <string.h> |
8 | #include <stdlib.h> |
9 | #include "bdbobj.h" |
10 | |
11 | int bdbobj_delete(struct bdbobj *obj, const char *key, size_t keylen) |
12 | { |
13 | DBT dkey, val; |
14 | |
15 | if (!obj->has_dbf) return (0); |
16 | |
17 | memset(&dkey, 0, sizeof(dkey)); |
18 | memset(&val, 0, sizeof(val)); |
19 | dkey.data=(void *)key; |
20 | dkey.size=keylen; |
21 | |
22 | #if DB_VERSION_MAJOR < 2 |
23 | if ( (*obj->dbf->del)(obj->dbf, &dkey, 0)) return (-1); |
24 | #else |
25 | if ( (*obj->dbf->del)(obj->dbf, 0, &dkey, 0)) return (-1); |
26 | #endif |
27 | return (0); |
28 | } |