Changeset 22067 for main/trunk/greenstone2/runtime-src
- Timestamp:
- 2010-05-07T21:11:22+12:00 (14 years ago)
- Location:
- main/trunk/greenstone2/runtime-src/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/colservr/collectset.cpp
r22050 r22067 339 339 { 340 340 #ifdef USE_SQLITE 341 sqlitedbclass *sql_db_ptr = new sqlitedbclass( );341 sqlitedbclass *sql_db_ptr = new sqlitedbclass(gsdlhome); 342 342 db_ptr = sql_db_ptr; 343 343 … … 361 361 { 362 362 #ifdef USE_MSSQL 363 mssqldbclass *mssql_db_ptr = new mssqldbclass( );363 mssqldbclass *mssql_db_ptr = new mssqldbclass(gsdlhome); 364 364 db_ptr = mssql_db_ptr; 365 365 … … 388 388 if (db_ptr == NULL) { 389 389 #ifdef USE_GDBM 390 db_ptr = new gdbmclass( );390 db_ptr = new gdbmclass(gsdlhome); 391 391 #else 392 392 cerr << "Warning: infodbtype of 'gdbm' was not compiled in to " << endl; -
main/trunk/greenstone2/runtime-src/src/recpt/argdb.cpp
r15683 r22067 27 27 #ifdef GSDL_USE_COLLECTOR_ACTION 28 28 29 #include "fileutil.h" 30 29 31 // argdb is used by the collector for storing cgi arguments on disk (in a database) 30 32 31 33 #include "argdb.h" 34 35 #if defined(USE_GDBM) 32 36 #include "gdbmclass.h" 37 #define DBCLASS gdbmclass 38 #define DBFNAME "argdb.gdb" 33 39 34 argdb::argdb (const text_t &filename) { 35 dbfile = filename; 40 #elif defined(USE_JDBM) 41 #include "jdbmnaiveclass.h" 42 #define DBCLASS jdbmnaiveclass 43 #define DBFNAME "argdb.jdb" 44 45 #elif defined(USE_SQLITE) 46 #include "sqlitedbclass.h" 47 #define DBCLASS sqlitedbclass 48 #define DBFNAME "argdb.litedb" 49 50 #elif defined(USE_MSSQL) 51 #include "mssqldbclass.h" 52 #define DBCLASS mssqldbclass 53 #define DBFNAME "argdb.msdb" 54 55 #else 56 #error "Unable to compile Greenstone. Need at least one database backend enabled." 57 #endif 58 59 60 argdb::argdb (const text_t& gsdlhome, const text_t &args_tmp) { 61 62 gsdlhome_ = gsdlhome; 63 dbfile_ = filename_cat(gsdlhome, "tmp", args_tmp, DBFNAME); 64 36 65 } 37 66 38 67 bool argdb::update_args (text_tmap &argmap) { 39 gdbmclass argdb; 40 if (!argdb.opendatabase(dbfile, DB_WRITER_CREATE, 1000, true)) return false; 68 69 DBCLASS argdb(gsdlhome_); 70 if (!argdb.opendatabase(dbfile_, DB_WRITER_CREATE, 1000, true)) return false; 41 71 infodbclass info; 42 72 … … 59 89 bool argdb::get_args (text_tmap &argmap) { 60 90 argmap.erase(argmap.begin(), argmap.end()); 61 gdbmclass argdb;62 if (!argdb.opendatabase(dbfile , DB_READER, 1000, true)) return false;91 DBCLASS argdb(gsdlhome_); 92 if (!argdb.opendatabase(dbfile_, DB_READER, 1000, true)) return false; 63 93 infodbclass info; 64 94 -
main/trunk/greenstone2/runtime-src/src/recpt/argdb.h
r15432 r22067 36 36 protected: 37 37 38 text_t dbfile; 38 text_t gsdlhome_; 39 text_t dbfile_; 39 40 40 41 public: 41 42 42 argdb (const text_t &filename);43 argdb (const text_t& gsdlhome, const text_t &args_tmp); 43 44 virtual ~argdb () {} 44 45 -
main/trunk/greenstone2/runtime-src/src/recpt/collectoraction.cpp
r21877 r22067 306 306 } 307 307 308 text_t argfile = filename_cat(gsdlhome, "tmp", args["bc1tmp"], "argdb.gdb"); 309 argdb *args_on_disk = new argdb(argfile); 308 argdb *args_on_disk = new argdb(gsdlhome,args["bc1tmp"]); 310 309 if (!args_on_disk->update_args(saved_args)) { 311 310 // error 312 logout << "collectoraction: argdb::update_args failed (" << argfile << ")\n";311 logout << "collectoraction: argdb::update_args failed\n"; 313 312 } 314 313 … … 317 316 if (!args_on_disk->get_args(saved_args)) { 318 317 // error 319 logout << "collectoraction: argdb::get_args failed (" << argfile << ")\n";318 logout << "collectoraction: argdb::get_args failed\n"; 320 319 } 321 320 delete args_on_disk; -
main/trunk/greenstone2/runtime-src/src/recpt/historydb.cpp
r21485 r22067 31 31 #include "dbclass.h" 32 32 33 #if def USE_GDBM33 #if defined(USE_GDBM) 34 34 #include "gdbmclass.h" 35 #define DBCLASS gdbmclass 36 //#define DBFNAME "history.gdb" 37 38 #elif defined(USE_JDBM) 39 #include "jdbmnaiveclass.h" 40 #define DBCLASS jdbmnaiveclass 41 //#define DBFNAME "history.jdb" 42 43 #elif defined(USE_SQLITE) 44 #include "sqlitedbclass.h" 45 #define DBCLASS sqlitedbclass 46 //#define DBFNAME "history.litedb" 47 48 #elif defined(USE_MSSQL) 49 #include "mssqldbclass.h" 50 #define DBCLASS mssqldbclass 51 //#define DBFNAME "history.msdb" 52 53 #else 54 #error "Unable to compile Greenstone. Need at least one database backend enabled." 35 55 #endif 36 56 … … 40 60 41 61 42 dbclass* get_history_db_ptr ( )62 dbclass* get_history_db_ptr (const text_t& gsdlhome) 43 63 { 44 64 // Create a dbclass of the correct type 45 65 dbclass *historydb = NULL; 46 66 47 // Use GDBM only at this stage 48 #ifdef USE_GDBM 49 historydb = new gdbmclass(); 50 #endif 67 historydb = new DBCLASS(gsdlhome); 51 68 52 69 return historydb; … … 62 79 63 80 // Create a dbclass of the correct type 64 dbclass *historydb = get_history_db_ptr( );81 dbclass *historydb = get_history_db_ptr(gsdlhome); 65 82 if (historydb == NULL) return false; 66 83 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); … … 98 115 99 116 // Create a dbclass of the correct type 100 dbclass *historydb = get_history_db_ptr( );117 dbclass *historydb = get_history_db_ptr(gsdlhome); 101 118 if (historydb == NULL) return false; 102 119 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); … … 153 170 154 171 // Create a dbclass of the correct type 155 dbclass *historydb = get_history_db_ptr( );172 dbclass *historydb = get_history_db_ptr(gsdlhome); 156 173 if (historydb == NULL) return false; 157 174 text_t historyfile = filename_cat(gsdlhome, "etc", "history") + historydb->getfileextension(); -
main/trunk/greenstone2/runtime-src/src/recpt/librarymain.cpp
r22046 r22067 157 157 recpt.add_action (adocumentaction); 158 158 159 text_t userdbfile = filename_cat(gsdlhome, "etc", "users.gdb"); 160 userdbclass *udb = new userdbclass(userdbfile); 161 162 text_t keydbfile = filename_cat(gsdlhome, "etc", "key.gdb"); 163 keydbclass *kdb = new keydbclass(keydbfile); 159 userdbclass *udb = new userdbclass(gsdlhome); 160 keydbclass *kdb = new keydbclass(gsdlhome); 164 161 165 162 #ifdef GSDL_USE_USERS_ACTION -
main/trunk/greenstone2/runtime-src/src/recpt/userdb.cpp
r21489 r22067 30 30 #include <stdlib.h> 31 31 32 #ifdef USE_GDBM 32 33 #if defined(USE_GDBM) 33 34 #include "gdbmclass.h" 35 #define DBCLASS gdbmclass 36 #define USERDBFNAME "users.gdb" 37 #define KEYDBFNAME "key.gdb" 38 39 #elif defined(USE_JDBM) 40 #include "jdbmnaiveclass.h" 41 #define DBCLASS jdbmnaiveclass 42 #define USERDBFNAME "users.jdb" 43 #define KEYDBFNAME "key.jdb" 44 45 #elif defined(USE_SQLITE) 46 #include "sqlitedbclass.h" 47 #define DBCLASS sqlitedbclass 48 #define USERDBFNAME "users.litedb" 49 #define KEYDBFNAME "key.litedb" 50 51 #elif defined(USE_MSSQL) 52 #include "mssqldbclass.h" 53 #define DBCLASS mssqldbclass 54 #define USERDBFNAME "users.msdb" 55 #define KEYDBFNAME "key.msdb" 56 57 #else 58 #error "Unable to compile Greenstone. Need at least one database backend enabled." 34 59 #endif 60 35 61 36 62 // include crypt … … 45 71 #endif 46 72 73 47 74 //==========================================// 48 75 // userinfo_t functions (Start) // … … 79 106 // userdbclass functions (Start) // 80 107 //==========================================// 81 userdbclass::userdbclass(const text_t &userdbfilename) 82 { 83 storeduserdbfilename = userdbfilename; 108 userdbclass::userdbclass(const text_t &gsdlhome) 109 { 110 111 storeduserdbfilename = filename_cat(gsdlhome, "etc", USERDBFNAME); 84 112 85 113 // Create a dbclass of the correct type 86 114 userdb = NULL; 87 115 88 // Use GDBM only at this stage 89 #ifdef USE_GDBM 90 userdb = new gdbmclass(); 91 #endif 116 // Use the correct database type 117 userdb = new DBCLASS(gsdlhome); 92 118 93 119 // Check a dbclass of some type has been created … … 385 411 // keydbclass functions (Start) // 386 412 //==========================================// 387 keydbclass::keydbclass(const text_t & keydbfilename)388 { 389 storedkeydbfilename = keydbfilename;413 keydbclass::keydbclass(const text_t &gsdlhome) 414 { 415 storedkeydbfilename = filename_cat(gsdlhome, "etc", KEYDBFNAME); 390 416 391 417 // Create a dbclass of the correct type 392 418 keydb = NULL; 393 419 394 // Use GDBM only at this stage 395 #ifdef USE_GDBM 396 keydb = new gdbmclass(); 397 #endif 420 // Use the correct DB class type at this stage 421 keydb = new DBCLASS(gsdlhome); 398 422 399 423 // Check a dbclass of some type has been created -
main/trunk/greenstone2/runtime-src/src/recpt/userdb.h
r15586 r22067 67 67 68 68 public: 69 userdbclass (const text_t & userdbfilename);69 userdbclass (const text_t &gsdlhome); 70 70 virtual ~userdbclass(); 71 71 … … 126 126 127 127 public: 128 keydbclass (const text_t & keydbfilename);128 keydbclass (const text_t &gsdlhome); 129 129 virtual ~keydbclass(); 130 130 // functions dealing with databases of temporary keys -
main/trunk/greenstone2/runtime-src/src/recpt/wizardaction.cpp
r21877 r22067 127 127 } 128 128 129 text_t argfile = filename_cat(gsdlhome, "tmp", args[macro_prefix+"tmp"], "argdb.gdb"); 130 argdb *args_on_disk = new argdb(argfile); 129 argdb *args_on_disk = new argdb(gsdlhome,args[macro_prefix+"tmp"]); 131 130 if (!args_on_disk->update_args(saved_args)) { 132 131 // error 133 logout << "wizardaction: argdb::update_args failed (" << argfile << ")\n";132 logout << "wizardaction: argdb::update_args failed\n"; 134 133 } 135 134 … … 138 137 if (!args_on_disk->get_args(saved_args)) { 139 138 // error 140 logout << "wizardaction: argdb::get_args failed (" << argfile << ")\n";139 logout << "wizardaction: argdb::get_args failed\n"; 141 140 } 142 141 delete args_on_disk;
Note:
See TracChangeset
for help on using the changeset viewer.