Bug 34640

Summary: Bindings lost in copy/move using mysql store
Product: Slide Reporter: Tara Talbott <tara.talbott>
Component: StoresAssignee: Slide Developer List <slide-dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: Nightly   
Target Milestone: ---   
Hardware: Other   
OS: other   

Description Tara Talbott 2005-04-27 00:11:41 UTC
We have noticed that if a collection is created and a resource added to it, 
then if you copy or move the collection the bindings between it and the child 
are lost (although typically this isn't noticed until the server is restarted 
because of caching).  This is because in the clear bindings method of the 
MySqlRDMSAdapter it deletes bindings based on the updated child uris only.  
And on a copy or move the children for the original ObjectNode are passed in. 
If the method is modified to check the for the parent half of the binding as 
well as the child in the delete binding statement it seems to fix the problem.

Below are changes to MySqlRDBMSAdapter which should fix the problem.

~line 219 
                statement =
+                    connection.prepareStatement(
+                        deleteStatement("BINDING","c",", URI u, URI u2 where 
+u.URI_ID = c.CHILD_UURI_ID and u2.URI_ID = c.URI_ID and u.URI_STRING IN "
+                            + bindings + " and u2.URI_STRING = ?") );
-                    connection.prepareStatement(
-                        deleteStatement("BINDING","c",", URI u where 
-u.URI_ID = c.CHILD_UURI_ID and u.URI_STRING IN "
-                            + bindings ) );


~lines 225 - 230
+               int i = 0;
+                for (i = 1; iter.hasNext(); i++) {
-                for (int i = 1; iter.hasNext(); i++) {
                    String next = iter.next().toString();
                    statement.setString(i, next);
                }
+                statement.setString(i++, uri.toString());