Project

General

Profile

« Previous | Next » 

Revision 818

Added by berkley almost 23 years ago

fixed error with out of cursors error because pstmts were not getting closed in DBQuery

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
367 367
          tableHasRows = rs.next();
368 368
        }
369 369
        rs.close();
370
        //pstmt.close();
370
        pstmt.close();
371 371
        
372 372
        if (qspec.containsExtendedSQL())
373 373
        {
......
382 382
            doclist.append("',");
383 383
          }
384 384
          doclist.deleteCharAt(doclist.length()-1); //remove the last comma
385
          pstmt.close();
385
          //pstmt.close();
386 386
          pstmt = dbconn.prepareStatement(qspec.printExtendedSQL(
387 387
                                        doclist.toString()));
388 388
          pstmt.execute();
......
420 420
          }
421 421
          rs.close();
422 422
        }
423

  
423
        pstmt.close();
424
        
424 425
        //this loop adds the relation data to the resultdoc
425 426
        //this code might be able to be added to the backtracking code above
426 427
        Enumeration docidkeys = docListResult.keys();
......
429 430
          //String connstring = "metacat://"+util.getOption("server")+"?docid=";
430 431
          String connstring = "%docid=";
431 432
          String docidkey = (String)docidkeys.nextElement();
432

  
433
          pstmt.close();
434 433
          pstmt = dbconn.prepareStatement(qspec.printRelationSQL(docidkey));
435 434
          pstmt.execute();
436 435
          rs = pstmt.getResultSet();
src/edu/ucsb/nceas/metacat/DocumentImpl.java
621 621
        this.publicaccess   = rs.getString(9);
622 622
        this.rev            = rs.getInt(10);
623 623
      } 
624

  
624
      pstmt.close();
625 625
      if (this.doctype != null) {
626 626
        pstmt =
627 627
          conn.prepareStatement("SELECT system_id " +
......
636 636
        if (tableHasRows) {
637 637
          this.system_id  = rs.getString(1);
638 638
        } 
639
        //pstmt.close();
639
        pstmt.close();
640 640
      }
641 641
    } catch (SQLException e) {
642 642
      System.out.println("error in DocumentImpl.getDocumentInfo: " + 
......
775 775
        pstmt = conn.prepareStatement(
776 776
                "DELETE FROM xml_index WHERE docid='" + this.docid + "'");
777 777
        pstmt.execute();
778
        //pstmt.close();
778
        pstmt.close();
779 779

  
780 780
        // Update the new document to reflect the new node tree
781 781
        pstmt = conn.prepareStatement(

Also available in: Unified diff