Project

General

Profile

« Previous | Next » 

Revision 428

Added by bojilova almost 24 years ago

change the 2 executions in archiveDocRevision()
with 1 statement:
"insert into xml_revisions
select ... from xml_documents where docid = ..."

View differences:

src/edu/ucsb/nceas/metacat/DocumentImpl.java
621 621
  /** Save a document entry in the xml_revisions table */
622 622
  private static void archiveDocRevision(Connection conn, String docid,
623 623
                                         String user) throws SQLException {
624
    // create a record in xml_revisions table 
625
    // for that document as selected from xml_documents
626
    PreparedStatement pstmt = conn.prepareStatement(
627
      "INSERT INTO xml_revisions " +
628
        "(revisionid, docid, rootnodeid, docname, doctype, doctitle, " +
629
        "user_owner, user_updated, date_created, date_updated) " +
630
      "SELECT null, ?, rootnodeid, docname, doctype, doctitle," + 
631
        "user_owner, ?, sysdate, sysdate "+
632
      "FROM xml_documents " +
633
      "WHERE docid = ?");
634
    // Bind the values to the query and execute it
635
    pstmt.setString(1, docid);
636
    pstmt.setString(2, user);
637
    pstmt.setString(3, docid);
638
    pstmt.execute();
639
    pstmt.close();
640

  
641
  }
642

  
643
  /** Save a document entry in the xml_revisions table */
644
/*
645
  private static void archiveDocRevision(Connection conn, String docid,
646
                                         String user) throws SQLException {
624 647
    // First get all of the values we need
625 648
    long rnodeid = -1;
626 649
    String docname = null;
......
671 694
    pstmt.execute();
672 695
    pstmt.close();
673 696
  }
674

  
697
*/
675 698
  /**
676 699
   * Set up the parser handlers for writing the document to the database
677 700
   */

Also available in: Unified diff