Changeset 15729 for gsdl


Ignore:
Timestamp:
2008-05-27T16:09:01+12:00 (16 years ago)
Author:
mdewsnip
Message:

(Adding new DB support) Now the collection server looks at the "infodbtype" field in build.cfg and creates either a "gdbmclass" or "sqlitedbclass" as appropriate!

Location:
gsdl/trunk/src/colservr
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/src/colservr/Makefile.in

    r15684 r15729  
    3232USE_SQLITE = @USE_SQLITE@
    3333ifeq ($(USE_SQLITE), 1)
     34SQLITE_DEFINES = -DUSE_SQLITE
    3435SQLITE_INCLUDES = -I$(PACKAGES_DIR)/sqlite/sqlite3/linux/include
    3536SQLITE_OBJECTS = sqlitedbclass.o
    3637SQLITE_SOURCES = sqlitedbclass.cpp
    3738else
     39SQLITE_DEFINES =
    3840SQLITE_INCLUDES =
    3941SQLITE_OBJECTS =
     
    4749CFLAGS = @CFLAGS@ @COMPAT32BITFLAGS@
    4850CXXFLAGS = @CXXFLAGS@ @COMPAT32BITFLAGS@
    49 DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER
     51DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DGSDLSERVER $(SQLITE_DEFINES)
    5052# Do NOT add the "recpt" directory here: the colserver should be independent of the receptionist!
    5153INCLUDES = @GDBM_INCLUDE@ -I. -I$(GSDL_DIR) -I$(GSDL_DIR)/lib \
  • gsdl/trunk/src/colservr/collectset.cpp

    r15682 r15729  
    4242#include <assert.h>
    4343
     44#ifdef USE_SQLITE
     45#include "sqlitedbclass.h"
     46#endif
     47
    4448
    4549collectset::collectset (text_t &gsdlhome) {
     
    194198  // read config file to see if built with mg, mgpp, or lucene
    195199  text_t buildtype = "mg"; // mg is default
     200  text_t infodbtype = "gdbm"; // gdbm is default
    196201
    197202  text_tarray cfgline;
     
    208213    if (key == "buildtype") {
    209214      buildtype = cfgline[0];
    210       break;
     215    }
     216    if (key == "infodbtype") {
     217      infodbtype = cfgline[0];
    211218    }
    212219      }
     
    217224
    218225  collectserver *cserver = new collectserver();
    219   gdbmclass *db_ptr = new gdbmclass();
     226
     227  // Create a dbclass of the correct type
     228  dbclass *db_ptr = NULL;
     229
     230#ifdef USE_SQLITE
     231  if (infodbtype == "sqlite")
     232  {
     233    db_ptr = new sqlitedbclass();
     234  }
     235#endif
     236
     237  // Use GDBM if the infodb type is empty or not one of the values above
     238  if (db_ptr == NULL)
     239  {
     240    db_ptr = new gdbmclass();
     241  }
    220242
    221243  // add a null filter
Note: See TracChangeset for help on using the changeset viewer.