Changeset 15584 for gsdl/trunk/src/colservr/gdbmsource.cpp
- Timestamp:
- 2008-05-20T10:22:16+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/src/colservr/gdbmsource.cpp
r13780 r15584 31 31 32 32 gdbmsourceclass::gdbmsourceclass () { 33 gdbmptr = NULL;33 db_ptr = NULL; 34 34 textsearchptr = NULL; 35 35 classname = "gdbmsource"; … … 37 37 38 38 gdbmsourceclass::~gdbmsourceclass () { 39 if ( gdbmptr != NULL) delete gdbmptr;39 if (db_ptr != NULL) delete db_ptr; 40 40 if (textsearchptr != NULL) delete textsearchptr; 41 41 } … … 117 117 indexstem = collection; 118 118 } 119 gdbm_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem);120 if (littleEndian()) gdbm_filename += ".ldb";121 else gdbm_filename += ".bdb";122 123 if (!file_exists( gdbm_filename)) {119 db_filename = filename_cat(gdbmhome, "collect", collection, "index", "text", indexstem); 120 if (littleEndian()) db_filename += ".ldb"; 121 else db_filename += ".bdb"; 122 123 if (!file_exists(db_filename)) { 124 124 logout << text_t2ascii 125 << "warning: gdbm database \"" //**** 126 << gdbm_filename << "\" does not exist\n\n"; 127 // return false; //**** 125 << "warning: database \"" << db_filename << "\" does not exist\n\n"; 126 // return false; 128 127 } 129 128 … … 137 136 138 137 err = noError; 139 if ( gdbmptr == NULL) {138 if (db_ptr == NULL) { 140 139 // most likely a configuration problem 141 140 logout << text_t2ascii 142 << "configuration error: " << classname << " contains a null gdbmclass\n\n";141 << "configuration error: " << classname << " contains a null dbclass\n\n"; 143 142 err = configurationError; 144 143 return true; … … 146 145 147 146 // open the database 148 gdbmptr->setlogout(&logout); 149 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 150 // most likely a system problem (we have already checked that the 151 // gdbm database exists) 147 db_ptr->setlogout(&logout); 148 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 149 // most likely a system problem (we have already checked that the database exists) 152 150 logout << text_t2ascii 153 << "system problem: open on gdbm database \"" 154 << gdbm_filename << "\" failed\n\n"; 151 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 155 152 err = systemProblem; 156 153 return true; … … 158 155 159 156 infodbclass info; 160 OIDout = gdbmptr->translate_OID (OIDin, info);161 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open157 OIDout = db_ptr->translate_OID (OIDin, info); 158 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 162 159 return true; 163 160 } … … 172 169 173 170 err = noError; 174 if ( gdbmptr == NULL) {171 if (db_ptr == NULL) { 175 172 // most likely a configuration problem 176 173 logout << text_t2ascii 177 << "configuration error: " << classname <<" contains a null gdbmclass\n\n";174 << "configuration error: " << classname <<" contains a null dbclass\n\n"; 178 175 err = configurationError; 179 176 return true; … … 181 178 182 179 // open the database 183 gdbmptr->setlogout(&logout); 184 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 185 // most likely a system problem (we have already checked that the 186 // gdbm database exists) 180 db_ptr->setlogout(&logout); 181 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 182 // most likely a system problem (we have already checked that the database exists) 187 183 logout << text_t2ascii 188 << "system problem: open on gdbm database \"" 189 << gdbm_filename << "\" failed\n\n"; 184 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 190 185 err = systemProblem; 191 186 return true; … … 204 199 while (this_OID != end_OID) { 205 200 infodbclass info; 206 if (! gdbmptr->getinfo(*this_OID, info)) return false;201 if (!db_ptr->getinfo(*this_OID, info)) return false; 207 202 208 203 // adjust the metadata … … 260 255 parentOID = thisparent; 261 256 parentcontents.erase(parentcontents.begin(), parentcontents.end()); 262 if ( gdbmptr->getinfo(parentOID, parentinfo)) {257 if (db_ptr->getinfo(parentOID, parentinfo)) { 263 258 text_t &parentinfocontains = parentinfo["contains"]; 264 259 if (!parentinfocontains.empty()) … … 316 311 } 317 312 318 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open313 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 319 314 return true; 320 315 } … … 327 322 328 323 err = noError; 329 if ( gdbmptr == NULL) {324 if (db_ptr == NULL) { 330 325 // most likely a configuration problem 331 326 logout << text_t2ascii 332 << "configuration error: " << classname << " contains a null gdbmclass\n\n";327 << "configuration error: " << classname << " contains a null dbclass\n\n"; 333 328 err = configurationError; 334 329 return true; … … 336 331 337 332 // open the database 338 gdbmptr->setlogout(&logout); 339 if (!gdbmptr->opendatabase (gdbm_filename, GDBM_READER, 100, false)) { 340 // most likely a system problem (we have already checked that the 341 // gdbm database exists) 333 db_ptr->setlogout(&logout); 334 if (!db_ptr->opendatabase (db_filename, DB_READER, 100, false)) { 335 // most likely a system problem (we have already checked that the database exists) 342 336 logout << text_t2ascii 343 << "system problem: open on gdbm database \"" 344 << gdbm_filename << "\" failed\n\n"; 337 << "system problem: open on database \"" << db_filename << "\" failed\n\n"; 345 338 err = systemProblem; 346 339 return true; … … 351 344 translate_OID (OID, tOID, err, logout); 352 345 infodbclass info; 353 if (! gdbmptr->getinfo(tOID, info)) {354 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open346 if (!db_ptr->getinfo(tOID, info)) { 347 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 355 348 return false; 356 349 } … … 367 360 } 368 361 369 gdbmptr->closedatabase(); // Important that local library doesn't leave any files open362 db_ptr->closedatabase(); // Important that local library doesn't leave any files open 370 363 return true; 371 364 }
Note:
See TracChangeset
for help on using the changeset viewer.