Project

General

Profile

Revision 2503

Added by sgarg almost 16 years ago

Fixed a bug in printSQL function. The bug came into the picture for queries which involve multiple query groups and one of the query groups does a % search.

View differences:

src/edu/ucsb/nceas/metacat/QueryGroup.java
96 96
      Enumeration en= getChildren();
97 97
      while (en.hasMoreElements()) {
98 98
        Object qobject = en.nextElement();
99
        if (first) {
100
          first = false;
101
        } else {
102
	  if(!queryString.toString().equals("")){
103
          	queryString.append(" " + operator + " ");
104
	  }
105
        }
99

  
106 100
        if (qobject instanceof QueryGroup) {
101
          if (first) {
102
            first = false;
103
          } else {
104
             if(!queryString.toString().equals("")){
105
                    queryString.append(" " + operator + " ");
106
             }
107
          }
107 108
          QueryGroup qg = (QueryGroup)qobject;
108 109
          queryString.append(qg.printSQL(useXMLIndex));
109 110
          // count percerntage number
......
113 114
           QueryTerm qt = (QueryTerm)qobject;
114 115
           String termQueryString = qt.printSQL(useXMLIndex);
115 116
           if(!(qt.getSearchMode().equals("contains") && qt.getValue().equals("%"))){
117
               if (first) {
118
                   first = false;
119
               } else {
120
                   if(!queryString.toString().equals("")){
121
                       queryString.append(" " + operator + " ");
122
                   }
123
               }
116 124
               queryString.append(termQueryString);
117 125
           }
118 126
           // count percerntage number

Also available in: Unified diff