diff options
author | Francois Rouaix <francois.rouaix@gmail.com> | 1998-03-16 09:45:37 +0000 |
---|---|---|
committer | Francois Rouaix <francois.rouaix@gmail.com> | 1998-03-16 09:45:37 +0000 |
commit | c9f077f8db3972f1e977b264833ef87d7bbd79e9 (patch) | |
tree | fca286ee8d977e0e2526d47772cdbcabbb3bbc6f /otherlibs/db/dbstubs.c | |
parent | c0d06c862a072df3e8047037e89ab78785714180 (diff) |
Changed interface of dbopen
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1890 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/db/dbstubs.c')
-rw-r--r-- | otherlibs/db/dbstubs.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/otherlibs/db/dbstubs.c b/otherlibs/db/dbstubs.c index 5e2b67c67..c44daecd7 100644 --- a/otherlibs/db/dbstubs.c +++ b/otherlibs/db/dbstubs.c @@ -187,7 +187,7 @@ value caml_db_sync(value cdb) /* ML */ raise_db("sync"); } -value caml_db_open(value vfile, value vflags, value vmode, value vdup) /* ML */ +value caml_db_open(value vfile, value vflags, value vmode, value vpars) /* ML */ { char *file = String_val(vfile); int flags = convert_flag_list(vflags, db_open_flags); @@ -198,7 +198,27 @@ value caml_db_open(value vfile, value vflags, value vmode, value vdup) /* ML */ /* Infos for btree structure : 0 is default everywhere */ info = stat_alloc(sizeof(BTREEINFO)); bzero(info, sizeof(BTREEINFO)); - if (Bool_val(vdup)) info->flags |= R_DUP; + + while (Is_block(vpars)) { + value par = Field(vpars, 0); + if (Is_block(par)) { /* It's a non-constant constructor */ + switch(Tag_val(par)) { + case 0: /* Cachesize */ + info->cachesize = Int_val(Field(par, 0)); + default: + break; + } + } else { /* It's a constant constructor */ + switch (Int_val(par)) { + case 0: /* Duplicates */ + info->flags |= R_DUP; + break; + default: + break; + } + } + vpars = Field(vpars, 1); + } db = dbopen(file,flags,mode,DB_BTREE,info); if (db == NULL) { |