Changeset 1617
- Timestamp:
- 2000-10-26T19:40:20+13:00 (24 years ago)
- Location:
- trunk/gsdl/src/recpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/recpt/z3950proto.cpp
r1453 r1617 34 34 #include "z3950cfg.h" // for reading in config files - 35 35 // defines "struct z3950cfg *zserver_list" as the head of the list. 36 37 // note! yyin is hash-defined in z3950cfg.h to something else, to avoid 38 // name conflicts with "other" yyins. 36 39 extern FILE *yyin; 37 40 extern "C" { -
trunk/gsdl/src/recpt/z3950server.cpp
r1371 r1617 41 41 connected=false; 42 42 titles=NULL; 43 gotsinglerecord=false; 43 44 // for now, assume that all records will have text associated with them. 44 45 meta["hastxt"]="1"; … … 157 158 int first, int count, 158 159 int *nummatches, comerror_t &err) { 159 char **c_str_titles; 160 /* NOTE!!!!!! Because this code currently only works in cgi-bin mode, 161 we only ever do one request. Therefore, it is CURRENTLY OK to store 162 (cache) the retrieved titles, because if this function is ever called 163 more than once, the arguments will be the same each time. 164 (I think :) 165 */ 166 167 char **c_str_titles; 160 168 int i; 161 169 int last; 162 if (titles!=NULL) delete (titles); 170 171 if (gotsinglerecord==true) { 172 /* If true, then this whole execution was done to retrieve a single 173 document. Therefore, the list of titles of all records matching the 174 query isn't actually required. It's just that for some reason our 175 filter (z3950proto::filter) gets called at least 7 times, with the 176 7th being a "QueryFilter" for some reason... */ 177 nummatches=0; 178 return NULL; /* shouldn't really return NULL, but nummatches is checked 179 first (I hope) */ 180 } 181 182 // if (titles!=NULL) delete (titles); 183 if (titles!=NULL) return titles; 163 184 titles=new text_tarray; 164 185 … … 218 239 text_t &rettitle, 219 240 text_t &rettext, comerror_t &err) { 241 242 static char **c_str_titles=NULL; 243 static char *fulltext=NULL; 244 /* NOTE!!!!!! Because this code currently only works in cgi-bin mode, 245 we only ever do one request. Therefore, it is CURRENTLY OK to store 246 (cache) the retrieved titles, because if this function is ever called 247 more than once, the arguments will be the same each time. 248 (I think :) 249 */ 250 251 gotsinglerecord=true; // well, not yet, but we've been called... 252 220 253 if (connected==false) { 221 254 if (connect()==false) { … … 239 272 } 240 273 274 if (c_str_titles==NULL) 275 c_str_titles=z_getrecordTitles(ID,1); // check this return value. 276 241 277 if (rettitle!="unneeded") { 242 char **c_str_titles;243 278 //int dummy; 244 c_str_titles=z_getrecordTitles(ID,1); // check this return value.245 279 if (c_str_titles!=NULL && (int)c_str_titles[0]==1) { 246 280 rettitle.setcstr(c_str_titles[1]); // and check this 247 free (c_str_titles); 248 // rettitle="Dummy Title"; 281 ////// free (c_str_titles); - we want to "cache" it 249 282 } else { 250 283 // we didn't get something.... … … 253 286 } 254 287 288 if (fulltext==NULL) 289 // get the text 290 fulltext=z_getfullRecord(ID); 291 255 292 if (rettext!="unneeded") { 256 // get the text 257 rettext.setcstr(z_getfullRecord(ID)); 293 rettext.setcstr(fulltext); 258 294 } 259 295 return (true); -
trunk/gsdl/src/recpt/z3950server.h
r1371 r1617 41 41 bool connect(); 42 42 bool connected; // tcp connection to the z39.50 server (target) 43 bool gotsinglerecord; // if we do, then we don't need all titles... 43 44 44 45 public:
Note:
See TracChangeset
for help on using the changeset viewer.