Changeset 21485 for main/trunk/greenstone2/runtime-src/src
- Timestamp:
- 2010-01-15T17:32:09+13:00 (14 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/Makefile.in
r21324 r21485 81 81 endif 82 82 83 # Currently not configurable, and always on 84 USE_GDBM = 1 85 ifeq ($(USE_GDBM), 1) 86 GDBM_DEFINES = -DUSE_GDBM 87 GDBM_INCLUDES = -I$(COMMON_PACKAGES_DIR)/gdbm/include 88 else 89 GDBM_DEFINES = 90 GDBM_INCLUDES = 91 endif 92 83 93 USE_SQLITE = @USE_SQLITE@ 84 94 ifeq ($(USE_SQLITE), 1) … … 125 135 CXX = @CXX@ 126 136 CXXFLAGS = @CXXFLAGS@ @COMPAT32BITFLAGS@ 127 DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H $(FASTCGI_DEFS) $( Z3950_DEFS)128 INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib -I$(COMMON_PACKAGES_DIR)/gdbm/include\137 DEFS = @DEFS@ -DNZDL -DQUIET -DSHORT_SUFFIX -DPARADOCNUM -DHAVE_CONFIG_H $(FASTCGI_DEFS) $(GDBM_DEFINES) $(Z3950_DEFS) 138 INCLUDES = -I. -I$(GSDL_DIR) -I$(COMMON_DIR)/src/lib \ 129 139 -I$(COLSERVR_DIR) -I$(PROTOCOL_DIR) \ 130 140 $(MG_INCLUDES) $(MGPP_INCLUDES) \ 131 -I$(COMMON_PACKAGES_DIR)/expat/include $(FASTCGI_INCLUDES) $( Z3950_INCLUDES)141 -I$(COMMON_PACKAGES_DIR)/expat/include $(FASTCGI_INCLUDES) $(GDBM_INCLUDES) $(Z3950_INCLUDES) 132 142 INSTALL = @INSTALL@ 133 143 LDFLAGS = @LDFLAGS@ @COMPAT32BITFLAGS@ -
main/trunk/greenstone2/runtime-src/src/recpt/historydb.cpp
r19062 r21485 29 29 #include "recptproto.h" 30 30 #include "recptprototools.h" 31 #include "dbclass.h" 32 33 #ifdef USE_GDBM 31 34 #include "gdbmclass.h" 35 #endif 36 32 37 33 38 #define MAX_RECORDS 20 34 39 #define HIST_SEP ';' 40 41 42 dbclass* get_history_db_ptr () 43 { 44 // Create a dbclass of the correct type 45 dbclass *historydb = NULL; 46 47 // Use GDBM only at this stage 48 #ifdef USE_GDBM 49 historydb = new gdbmclass(); 50 #endif 51 52 return historydb; 53 } 54 35 55 36 56 // returns true on success (in which case historyinfo will contain … … 39 59 const text_t &gsdlhome, ostream &logout) { 40 60 41 text_t historyfile = filename_cat(gsdlhome, "etc", "history.gdb");42 43 61 bool result = false; 62 63 // Create a dbclass of the correct type 64 dbclass *historydb = get_history_db_ptr(); 65 if (historydb == NULL) return false; 66 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); 67 44 68 // open the history database 45 gdbmclass historydb; 46 47 if (historydb.opendatabase(historyfile, DB_READER, 1000, true)) { 69 if (historydb->opendatabase(historyfile, DB_READER, 1000, true)) { 48 70 // get history list 49 71 text_t historyresult; 50 72 51 historydb .getkeydata(userid, historyresult);73 historydb->getkeydata(userid, historyresult); 52 74 53 75 if (historyresult != "") { // there are entries, process them … … 56 78 result = true; 57 79 } 58 historydb .closedatabase();80 historydb->closedatabase(); 59 81 60 82 } else { … … 62 84 logout << text_t2ascii << "couldn't open history database " << historyfile << "\n"; 63 85 } 86 87 delete historydb; 64 88 return result; 65 89 } … … 71 95 bool set_history_info (const text_t &userid, const text_t &history, const text_t &gsdlhome, bool display) { 72 96 73 text_t historyfile = filename_cat(gsdlhome, "etc", "history.gdb");74 75 97 bool result = false; 76 // open the history database 77 gdbmclass historydb; 98 99 // Create a dbclass of the correct type 100 dbclass *historydb = get_history_db_ptr(); 101 if (historydb == NULL) return false; 102 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); 78 103 79 104 text_t oldhistoryresult; … … 81 106 int numentries=0; 82 107 83 if (!historydb.opendatabase(historyfile, DB_READER, 1000, true)) { 108 // open the history database 109 if (!historydb->opendatabase(historyfile, DB_READER, 1000, true)) { 84 110 // not created yet 85 111 oldhistoryresult=""; … … 89 115 90 116 // get history list 91 if (! historydb .getkeydata(userid, oldhistoryresult)) {117 if (! historydb->getkeydata(userid, oldhistoryresult)) { 92 118 oldhistoryresult=""; 93 119 if (!display) return true; // dont need to save 94 120 } 95 historydb .closedatabase();121 historydb->closedatabase(); 96 122 } 97 123 … … 105 131 106 132 // open for writing 107 if (!historydb .opendatabase(historyfile, DB_WRITER_CREATE, 1000, true)) return false;133 if (!historydb->opendatabase(historyfile, DB_WRITER_CREATE, 1000, true)) return false; 108 134 109 135 // add on new linethe new record to the front of the list, then add the … … 115 141 } 116 142 117 if (historydb .setkeydata(userid, newhistoryresult))143 if (historydb->setkeydata(userid, newhistoryresult)) 118 144 result=true; 119 145 120 historydb.closedatabase(); 146 historydb->closedatabase(); 147 delete historydb; 121 148 return result; 122 149 } … … 125 152 bool delete_all_history_info (const text_t &userid, const text_t &gsdlhome) { 126 153 127 text_t historyfile = filename_cat(gsdlhome, "etc", "history.gdb"); 154 // Create a dbclass of the correct type 155 dbclass *historydb = get_history_db_ptr(); 156 if (historydb == NULL) return false; 157 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); 128 158 129 159 // open the history database 130 gdbmclass historydb; 131 132 if (!historydb.opendatabase(historyfile, DB_WRITER, 1000, true)) return false; 133 134 historydb.deletekey(userid); 135 historydb.closedatabase(); 160 if (!historydb->opendatabase(historyfile, DB_WRITER, 1000, true)) return false; 161 162 historydb->deletekey(userid); 163 historydb->closedatabase(); 164 delete historydb; 136 165 return true; 137 166 -
main/trunk/greenstone2/runtime-src/src/recpt/win32.mak
r21435 r21485 44 44 DLLDEBUG = 0 45 45 ENABLE_ACCENTFOLD = 1 46 USE_GDBM = 1 46 47 USE_SQLITE = 1 47 48 ENABLE_MG = 1 … … 73 74 !ELSE 74 75 ACCENTFOLD_LIBS = 76 !ENDIF 77 78 !IF $(USE_GDBM) 79 GDBM_DEFINES = -DUSE_GDBM 80 GDBM_INCLUDES = -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows" 81 !ELSE 82 GDBM_DEFINES = 83 GDBM_INCLUDES = 75 84 !ENDIF 76 85 … … 121 130 CC = cl 122 131 DEFS = -D__WIN32__ -DHAVE_CONFIG_H -DPARADOCNUM -D_LITTLE_ENDIAN -DSHORT_SUFFIX -D_CRT_SECURE_NO_DEPRECATE \ 123 -DGSDL_NOCACHE $( Z3950_DEFS) $(MG_DEFS) $(MGPP_DEFS)132 -DGSDL_NOCACHE $(GDBM_DEFINES) $(Z3950_DEFS) $(MG_DEFS) $(MGPP_DEFS) 124 133 INCLUDES = -I. -I"$(GSDL_DIR)" -I"$(COMMON_DIR)\src\lib" -I"$(COLSERVR_DIR)" -I"$(PROTOCOL_DIR)" \ 125 134 $(MG_INCLUDES) $(MGPP_INCLUDES) \ 126 135 -I"$(COMMON_PACKAGES_DIR)\windows\crypt\crypt" -I"$(COMMON_PACKAGES_DIR)\windows\expat\expat" \ 127 -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3" -I"$(COMMON_PACKAGES_DIR)\gdbm\gdbm-1.8.3\windows"\136 $(GDBM_INCLUDES) \ 128 137 $(Z3950_INCLUDES) 129 138 LDFLAGS =
Note:
See TracChangeset
for help on using the changeset viewer.