wburrows    2004/12/07 13:05:50

  Modified:    src/stores/org/apache/slide/store/impl/rdbms Tag:
                        SLIDE_2_1_RELEASE_BRANCH DB2RDBMSAdapter.java
  Log:
  Defect 32460 fix: create dummy uri in uri table for child stores of root.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.3.2.5   +19 -16    
jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/DB2RDBMSAdapter.java
  
  Index: DB2RDBMSAdapter.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/stores/org/apache/slide/store/impl/rdbms/DB2RDBMSAdapter.java,v
  retrieving revision 1.3.2.4
  retrieving revision 1.3.2.5
  diff -u -r1.3.2.4 -r1.3.2.5
  --- DB2RDBMSAdapter.java      19 Oct 2004 14:51:49 -0000      1.3.2.4
  +++ DB2RDBMSAdapter.java      7 Dec 2004 21:05:50 -0000       1.3.2.5
  @@ -103,20 +103,23 @@
               while (bindings.hasMoreElements()) {
                   ObjectNode.Binding binding = (ObjectNode.Binding) 
bindings.nextElement();
                   try {
  -                                          long childID = 
getID(connection,binding.getUuri());
  +                    long childID = getID(connection,binding.getUuri());
                       /* 
  -                     * ChildID can be 0 if we are the root "/" and the child 
is a mount point for
  -                     * another store since it won't be listed in the tables 
of the root store. 
  +                     * childID can be 0 if we are the root "/" and the child 
is a mount point for
  +                     * another store since it won't have been added to the 
URI table since its is
  +                     * the root of another store. So when there's no URI for 
the child just create 
  +                     * a child URI for the binding table to refer to.
                        */ 
  -                    if (childID != 0) {
  -                        statement =
  -                            connection.prepareStatement(
  -                                "insert into BINDING (URI_ID, NAME, 
CHILD_UURI_ID) values (?,?,?)");
  -                        statement.setLong(1, uriid);
  -                        statement.setString(2, binding.getName());
  -                        statement.setLong(3, childID);
  -                        statement.executeUpdate();
  -                    }
  +                    if (childID == 0)
  +                        childID = assureUriId(connection, binding.getUuri());
  +                        
  +                    statement =
  +                        connection.prepareStatement(
  +                            "insert into BINDING (URI_ID, NAME, 
CHILD_UURI_ID) values (?,?,?)");
  +                    statement.setLong(1, uriid);
  +                    statement.setString(2, binding.getName());
  +                    statement.setLong(3, childID);
  +                    statement.executeUpdate();
                   } finally {
                       close(statement);
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to