Revision 423
Added by berkley over 24 years ago
src/edu/ucsb/nceas/metacat/QuerySpecification.java | ||
---|---|---|
302 | 302 |
public String printExtendedSQL() |
303 | 303 |
{ |
304 | 304 |
StringBuffer self = new StringBuffer(); |
305 |
self.append("select A.docid, A.nodename, B.nodedata from xml_nodes A, "); |
|
306 |
self.append("xml_nodes B where A.nodeid = B.parentnodeid "); |
|
307 |
self.append("and B.nodeid in "); |
|
308 |
self.append("(select distinct nodeid from xml_nodes where parentnodeid in "); |
|
309 |
self.append("(select nodeid from xml_index where path like '"); |
|
305 |
self.append("select xml_nodes.docid, xml_index.path, xml_nodes.nodedata "); |
|
306 |
self.append("from xml_index, xml_nodes where xml_index.nodeid="); |
|
307 |
self.append("xml_nodes.parentnodeid and (xml_index.path like '"); |
|
310 | 308 |
boolean firstfield = true; |
311 | 309 |
//put the returnfields into the query |
312 | 310 |
//the for loop allows for multiple fields |
... | ... | |
320 | 318 |
} |
321 | 319 |
else |
322 | 320 |
{ |
323 |
self.append("or path like '"); |
|
321 |
self.append("or xml_index.path like '");
|
|
324 | 322 |
self.append((String)returnFieldList.elementAt(i)); |
325 | 323 |
self.append("' "); |
326 | 324 |
} |
327 | 325 |
} |
328 |
self.append("))"); |
|
329 |
self.append(" AND B.docid in ("); |
|
326 |
self.append(") AND xml_nodes.docid in ("); |
|
330 | 327 |
self.append(query.printSQL()); |
331 | 328 |
self.append(")"); |
332 |
self.append(" AND B.nodetype = 'TEXT'");
|
|
329 |
self.append(" AND xml_nodes.nodetype = 'TEXT'");
|
|
333 | 330 |
|
331 |
//System.out.println(self.toString()); |
|
334 | 332 |
return self.toString(); |
335 | 333 |
} |
336 | 334 |
|
... | ... | |
557 | 555 |
|
558 | 556 |
/** |
559 | 557 |
* '$Log$ |
558 |
* 'Revision 1.13 2000/08/23 22:55:38 berkley |
|
559 |
* 'changed the field names to be case-sensitive in the returnfields |
|
560 |
* ' |
|
560 | 561 |
* 'Revision 1.12 2000/08/23 17:29:05 berkley |
561 | 562 |
* 'added support for the returnfield parameter |
562 | 563 |
* '-QuerySpecification now sets a flag (containsExtendedSQL) when there are returnfield items in the pathquery document. |
src/edu/ucsb/nceas/metacat/DBQuery.java | ||
---|---|---|
191 | 191 |
|
192 | 192 |
document = new StringBuffer(); |
193 | 193 |
|
194 |
document.append("<"); |
|
194 |
document.append("<param name=\"");
|
|
195 | 195 |
document.append(fieldname); |
196 |
document.append(">"); |
|
196 |
document.append("\">");
|
|
197 | 197 |
document.append(fielddata); |
198 |
document.append("</"); |
|
199 |
document.append(fieldname); |
|
200 |
document.append(">"); |
|
198 |
document.append("</param>"); |
|
201 | 199 |
|
202 | 200 |
tableHasRows = rs.next(); |
203 | 201 |
if(docListResult.containsKey(docid)) |
... | ... | |
218 | 216 |
System.err.println("Error printing qspec:"); |
219 | 217 |
System.err.println(ioe.getMessage()); |
220 | 218 |
} |
219 |
//System.out.println("docListResult: "); |
|
220 |
//System.out.println(docListResult.toString()); |
|
221 | 221 |
return docListResult; |
222 | 222 |
} |
223 | 223 |
|
... | ... | |
441 | 441 |
|
442 | 442 |
/** |
443 | 443 |
* '$Log$ |
444 |
* 'Revision 1.16 2000/08/23 22:55:25 berkley |
|
445 |
* 'changed the field names to be case-sensitive in the returnfields |
|
446 |
* ' |
|
444 | 447 |
* 'Revision 1.15 2000/08/23 17:22:07 berkley |
445 | 448 |
* 'added support for the returnfield parameter |
446 | 449 |
* '-added the dynamic parameters to the returned hash table of documents |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
396 | 396 |
Hashtable doclist = runQuery(xmlquery); |
397 | 397 |
String qformat = ((String[])params.get("qformat"))[0]; |
398 | 398 |
String resultdoc = createResultDocument(doclist, transformQuery(params)); |
399 |
|
|
400 | 399 |
//format and transform the results |
401 | 400 |
if(qformat.equals("html")) { |
402 | 401 |
transformResultset(resultdoc, response, out); |
Also available in: Unified diff
changed xslf for new returnfield scheme. the returnfields are now returned as <param name="<returnfield>"> tags.
hThe sql for the returnfield query was redone to fix a previous problem with slow queries