Project

General

Profile

« Previous | Next » 

Revision 899

Added by berkley about 22 years ago

made a ton of changes related to keeping oracle SQL code out of the main classes. fixed a bug where the timing of the index thread was off so when it went to index a document, the document was not already in xml_documents thus breaking the FK relation between xml_documents and xml_index. I think that bug might be the reason for the blank resultset screens in morpho. made the postgres implementation much more robust.

View differences:

DBSAXHandler.java
251 251
      MetaCatUtil util = new MetaCatUtil();
252 252
      dbconn = util.openDBConnection();
253 253
      dbconn.setAutoCommit(false);
254

  
254
      
255
      //the following while loop construct checks to make sure that the docid
256
      //of the document that we are trying to index is already
257
      //in the xml_documents table.  if this is not the case, the foreign
258
      //key relationship between xml_documents and xml_index is temporarily
259
      //broken causing multiple problems.
260
      boolean inxmldoc = false;
261
      while(!inxmldoc)
262
      {
263
        String xmlDocumentsCheck = "select distinct docid from xml_documents";
264
        PreparedStatement xmlDocCheck = dbconn.prepareStatement(xmlDocumentsCheck);
265
        xmlDocCheck.execute();
266
        ResultSet doccheckRS = xmlDocCheck.getResultSet();
267
        boolean tableHasRows = doccheckRS.next();
268
        Vector docids = new Vector();
269
        while(tableHasRows) 
270
        {
271
          docids.add(doccheckRS.getString(1).trim());
272
          tableHasRows = doccheckRS.next();
273
        }
274
        
275
        for(int i=0; i<docids.size(); i++)
276
        {
277
          String d = ((String)docids.elementAt(i)).trim();
278
          if(docid.trim().equals(d))
279
          {
280
            inxmldoc = true;
281
          }
282
        }
283
        xmlDocCheck.close();
284
      }
285
      
255 286
      // Going through the elements of the document and writing its Index
256 287
      Enumeration nodes = nodeIndex.elements();
257 288
      while ( nodes.hasMoreElements() ) {

Also available in: Unified diff