Project

General

Profile

« Previous | Next » 

Revision 314

Added by bojilova over 23 years ago

DBSAXNode constructor simplified

View differences:

DBSAXNode.java
48 48
   * @param parentNode the parent node for this node being created
49 49
   */
50 50
  public DBSAXNode (Connection conn, String tagname, DBSAXNode parentNode, 
51
                    DBSAXNode rootNode, DBSAXDocument currentDocument) {
51
                    DBSAXDocument currentDocument) {
52 52

  
53 53
    super(tagname);
54 54
    setParentID(parentNode.getNodeID());
55
    setRootNodeID(rootNode.getNodeID());
55
    setRootNodeID(currentDocument.getRootNodeID());
56 56
    setDocID(currentDocument.getDocID());
57 57
    setNodeIndex(parentNode.incChildNum());
58 58
    this.conn = conn;
59 59
    this.parentNode = parentNode;
60 60
    writeChildNodeToDB("ELEMENT", getTagName(), null);
61
    updateNodeIndex();
61
    updateNodeIndex(currentDocument.getDocID(), currentDocument.getDoctype());
62 62
  }
63 63
    
64 64
  /** creates SQL code and inserts new node into DB connection */
......
236 236
   * test strings that represent all of the relative and absolute
237 237
   * paths through the XML tree from document root to this node
238 238
   */
239
  private void updateNodeIndex() {
239
  private void updateNodeIndex(String docid, String doctype) {
240 240
    Hashtable pathlist = new Hashtable();
241 241
    boolean atStartingNode = true;
242 242
    boolean atRootDocumentNode = false;
......
271 271
    try {
272 272
      // Create an insert statement to reuse for all of the path insertions
273 273
      PreparedStatement pstmt = conn.prepareStatement(
274
              "INSERT INTO xml_index (nodeid, path) VALUES (?, ?)");
274
              "INSERT INTO xml_index (nodeid, path, docid, doctype) " + 
275
              "VALUES (?, ?, ?, ?)");
275 276
  
277
      pstmt.setString(3, docid);
278
      pstmt.setString(4, doctype);
279
      
276 280
      // Step through the hashtable and insert each of the path values
277 281
      Enumeration en = pathlist.keys();
278 282
      while (en.hasMoreElements()) {
......
301 305

  
302 306
/**
303 307
 * '$Log$
308
 * 'Revision 1.32  2000/06/27 04:31:07  jones
309
 * 'Fixed bugs associated with the new UPDATE and DELETE functions of
310
 * 'DBWriter.  There were problematic interactions between some static
311
 * 'variables used in DBEntityResolver and the way in which the
312
 * 'Servlet objects are re-used across multiple client invocations.
313
 * '
314
 * 'Generally cleaned up error reporting.  Now all errors and success
315
 * 'results are reported as XML documents from MetaCatServlet.  Need
316
 * 'to make the command line tools do the same.
317
 * '
304 318
 * 'Revision 1.31  2000/06/26 10:35:05  jones
305 319
 * 'Merged in substantial changes to DBWriter and associated classes and to
306 320
 * 'the MetaCatServlet in order to accomodate the new UPDATE and DELETE

Also available in: Unified diff