Project

General

Profile

« Previous | Next » 

Revision 602

Added by berkley over 23 years ago

fixed bug where some relations were not returned because the sql did not take into account an sql that had a directory structure in it.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
132 132
  public Hashtable findDocuments(Reader xmlquery, String user, String group,
133 133
                                 String[] returndoc)
134 134
  {
135
    //System.out.println("in finddocuments");
135 136
      Hashtable   docListResult = new Hashtable();
136 137
      PreparedStatement pstmt;
137 138
      String docid = null;
......
174 175
          doctitle = rs.getString(4);
175 176
          createDate = rs.getString(5);
176 177
          updateDate = rs.getString(6);
177
//System.out.println("vec.size = " + returndocVec.size());
178
          //System.out.println("vec.size = " + returndocVec.size());
178 179
          if(returndocVec.size() != 0 && !returndocVec.contains(doctype))
179 180
          { //there are returndocs to match (backtracking can now be performed). 
180
//System.out.println("olddoctype: " + doctype);
181
            //System.out.println("olddoctype: " + doctype);
181 182
            StringBuffer btBuf = new StringBuffer();
182 183
            btBuf.append("select object from xml_relation where ");
183 184
            btBuf.append("objdoctype in (");
......
192 193
            }
193 194
            btBuf.append(") ");
194 195
            btBuf.append("and subject like '");
195
            btBuf.append("metacat://").append(util.getOption("server"));
196
            btBuf.append("?docid=").append(docid).append("'");
196
            //btBuf.append("metacat://").append(util.getOption("server"));
197
            //btBuf.append("?docid=").append(docid).append("'");
198
            btBuf.append("%docid=").append(docid).append("'");
199
            System.out.println("sql: " + btBuf.toString());
200
            
197 201
            pstmt = conn.prepareStatement(btBuf.toString());
198 202
            pstmt.execute();
199 203
            ResultSet btrs = pstmt.getResultSet();
......
201 205
            if(hasBtRows)
202 206
            { //there was a backtrackable document found
203 207
              DocumentImpl xmldoc = null;
204
              //System.out.println("document found is: " + btrs.getString(1));
208
              System.out.println("document found is: " + btrs.getString(1));
205 209
              MetacatURL objURL = new MetacatURL(btrs.getString(1));
206 210
              try
207 211
              {
......
304 308
        Enumeration docidkeys = docListResult.keys();
305 309
        while(docidkeys.hasMoreElements())
306 310
        {
307
          String connstring = "metacat://"+util.getOption("server")+"?docid=";
311
          //String connstring = "metacat://"+util.getOption("server")+"?docid=";
312
          String connstring = "%docid=";
308 313
          String docidkey = (String)docidkeys.nextElement();
314
          System.out.println("relationsql: " + qspec.printRelationSQL(
315
                                                     connstring + docidkey));
309 316
          pstmt = conn.prepareStatement(
310 317
                  qspec.printRelationSQL(connstring + docidkey));
311 318
          pstmt.execute();

Also available in: Unified diff