apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr-util/dbm apr_dbm_berkeleydb.c
Date Fri, 04 Oct 2002 04:25:12 GMT
jerenkrantz    2002/10/03 21:25:12

  Modified:    dbm      apr_dbm_berkeleydb.c
  Log:
  Add further support for DB_AUTO_COMMIT flag which is required in DB4.1+
  when a NULL transaction is passed.
  
  Note that we treat DB 4.0 as DB_VER == 3, while higher versions of 4.x are
  treated as DB_VER == 4 which has these API changes.
  
  Revision  Changes    Path
  1.20      +25 -13    apr-util/dbm/apr_dbm_berkeleydb.c
  
  Index: apr_dbm_berkeleydb.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm_berkeleydb.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -u -r1.19 -r1.20
  --- apr_dbm_berkeleydb.c	19 Sep 2002 08:04:17 -0000	1.19
  +++ apr_dbm_berkeleydb.c	4 Oct 2002 04:25:12 -0000	1.20
  @@ -73,12 +73,14 @@
    */
   
   #if   defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 4)
  -/* DB 4.1 has an altered open() argument list. */
  +/* We will treat anything greater than 4.1 as DB4.
  + * We can treat 4.0 as DB3.
  + */
   #if   defined(DB_VERSION_MINOR) && (DB_VERSION_MINOR >= 1)
  -#define DB_NEED_OPEN_TXN_ARG
  -#endif
  -/* Otherwise, DB4 can be treated as DB3. */
  +#define DB_VER 4
  +#else
   #define DB_VER 3
  +#endif
   #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 3)
   #define DB_VER 3
   #elif defined(DB_VERSION_MAJOR) && (DB_VERSION_MAJOR == 2)
  @@ -196,10 +198,13 @@
       {
           int dberr;
   
  -#if DB_VER == 3
  +#if DB_VER >= 3
  +#if DB_VER == 4
  +        dbmode |= DB_AUTO_COMMIT;
  +#endif
           if ((dberr = db_create(&file.bdb, NULL, 0)) == 0) {
               if ((dberr = (*file.bdb->open)(file.bdb,
  -#ifdef DB_NEED_OPEN_TXN_ARG
  +#if DB_VER == 4
                                              NULL,
   #endif
                                              pathname, NULL, 
  @@ -283,6 +288,11 @@
       apr_status_t rv;
       DBT ckey = { 0 };
       DBT cvalue = { 0 };
  +#if DB_VER == 4
  +    int flags = DB_AUTO_COMMIT;
  +#else
  +    int flags = 0;
  +#endif
   
       ckey.data = key.dptr;
       ckey.size = key.dsize;
  @@ -294,7 +304,7 @@
                                            TXN_ARG
                                            &ckey,
                                            &cvalue,
  -                                         0));
  +                                         flags));
   
       /* store any error info into DBM, and return a status code. */
       return set_error(dbm, rv);
  @@ -304,6 +314,11 @@
   {
       apr_status_t rv;
       DBT ckey = { 0 };
  +#if DB_VER == 4
  +    int flags = DB_AUTO_COMMIT;
  +#else
  +    int flags = 0;
  +#endif
   
       ckey.data = key.dptr;
       ckey.size = key.dsize;
  @@ -311,7 +326,7 @@
       rv = db2s((*GET_BDB(dbm->file)->del)(GET_BDB(dbm->file),
                                            TXN_ARG
                                            &ckey,
  -                                         0));
  +                                         flags));
   
       /* store any error info into DBM, and return a status code. */
       return set_error(dbm, rv);
  @@ -346,11 +361,8 @@
       dberr = (*f->bdb->seq)(f->bdb, &first, &data, R_FIRST);
   #else
       if ((dberr = (*f->bdb->cursor)(f->bdb, NULL, &f->curs
  -#if DB_VER == 3
  -                                , 0
  -#elif (DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5) 
  -                                , 0
  -
  +#if DB_VER >= 3 || ((DB_VERSION_MAJOR == 2) && (DB_VERSION_MINOR > 5))
  +                                   , 0
   #endif
                )) == 0) {
           dberr = (*f->curs->c_get)(f->curs, &first, &data, DB_FIRST);
  
  
  

Mime
View raw message