Project

General

Profile

« Previous | Next » 

Revision 6146

escape quotes when processing returnfield with predicates. example:
<returnfield>dataset/dataTable/physical/distribution/online/url[@function='download']</returnfield>

View differences:

src/edu/ucsb/nceas/metacat/QuerySpecification.java
1002 1002
            //put the returnfields into the query
1003 1003
            //the for loop allows for multiple fields
1004 1004
            for (int i = 0; i < returnFieldList.size(); i++) {
1005
            	String returnField = (String) returnFieldList.elementAt(i);
1006
            	// in case we have predicate conditions with quotes
1007
            	returnField = returnField.replaceAll("'", "''");
1005 1008
                if (firstfield) {
1006 1009
                    firstfield = false;
1007
                    self.append( (String) returnFieldList.elementAt(i));
1010
                    self.append(returnField);
1008 1011
                    self.append("' ");
1009 1012
                }
1010 1013
                else {
1011 1014
                    self.append(", '");
1012
                    self.append( (String) returnFieldList.elementAt(i));
1015
                    self.append(returnField);
1013 1016
                    self.append("' ");
1014 1017
                }
1015 1018
            }

Also available in: Unified diff