Project

General

Profile

« Previous | Next » 

Revision 152

Added by bojilova over 24 years ago

changed getDocID() only to:
return docid;

View differences:

src/edu/ucsb/nceas/metacat/DBSAXDocument.java
87 87
        }
88 88
    }
89 89

  
90
    /** look up the assigned doc id from DB connection */
90
    /** Get doc id */
91 91
    public long getDocID() {
92
      long doc_id=0;
93
      Statement stmt;
94
      try {
95
        stmt = conn.createStatement();
96
        stmt.execute("SELECT xml_documents_id_seq.currval FROM dual");
97
        ResultSet rs = stmt.getResultSet();
98
        boolean tableHasRows = rs.next();
99
        if (tableHasRows) {
100
          doc_id = rs.getLong(1);
101
        }
102
        stmt.close();
103
      } catch (SQLException e) {
104
        System.out.println("Error getting id: " + e.getMessage());
105
      }
106

  
107
      // assign the new ID number
108
      return doc_id;
92
      return docid;
109 93
    }
110 94

  
111 95
    /**

Also available in: Unified diff