Changeset 21489

Show
Ignore:
Timestamp:
18.01.2010 14:13:17 (9 years ago)
Author:
mdewsnip
Message:

Modifying userdb.cpp so it uses the more general dbclass object instead of being hard-wired to use gdbmclass. However, this class is still set up to use gdbm, provided USE_GDBM is set (which it always is in the main Greenstone). The problem with the user database is it is Greenstone-specific, not collection-specific, so there is no infodbtype option to check to see what database type should be used (a new option will need to be created in the main.cfg file). If USE_GDBM isn't set, the userdb class will do nothing.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/userdb.cpp

    r15630 r21489  
    2626#include "gsdlconf.h" 
    2727#include "userdb.h" 
    28 #include "gdbmclass.h" 
    2928#include "gsdltimes.h" 
    3029#include "fileutil.h" 
    3130#include <stdlib.h> 
     31 
     32#ifdef USE_GDBM 
     33#include "gdbmclass.h" 
     34#endif 
    3235 
    3336// include crypt 
     
    7982{ 
    8083  storeduserdbfilename = userdbfilename; 
     84 
     85  // Create a dbclass of the correct type 
     86  userdb = NULL; 
     87 
     88  // Use GDBM only at this stage 
     89#ifdef USE_GDBM 
    8190  userdb = new gdbmclass(); 
     91#endif 
     92 
     93  // Check a dbclass of some type has been created 
     94  if (userdb == NULL) 
     95  { 
     96    activated = false; 
     97    return; 
     98  } 
     99 
    82100  activated = (!userdb->opendatabase(storeduserdbfilename, DB_READER, 1000, true)) ? false : true; 
    83101  if (activated == false)  
     
    370388{ 
    371389  storedkeydbfilename = keydbfilename; 
     390 
     391  // Create a dbclass of the correct type 
     392  keydb = NULL; 
     393 
     394  // Use GDBM only at this stage 
     395#ifdef USE_GDBM 
    372396  keydb = new gdbmclass(); 
     397#endif 
     398 
     399  // Check a dbclass of some type has been created 
     400  if (keydb == NULL) 
     401  { 
     402    activated = false; 
     403    return; 
     404  } 
     405 
    373406  activated = keydb->opendatabase(storedkeydbfilename, DB_READER, 1000, true); 
    374407  if (activated == false)