thanks, i noticed the "delete PERMISSIONS from PERMISSIONS" part after i sent the 
email out. 
 
Could slide team please fix the bug in CommonsRDBMSAdapter.java?.
fix based on StandardRDBMSAdapter.java changes:
 
public void revokePermission(Connection connection, Uri uri, NodePermission permission)
   throws ServiceAccessException {
   if (permission == null) return;
   PreparedStatement statement = null;
   try {
       NodeRevisionNumber revisionNumber = permission.getRevisionNumber();
       statement =
          connection.prepareStatement(
          //fix:begin: added null check for revision no
          //"delete from " + PERMISSIONS_TABLE + " p where p.OBJECT_ID in (select 
ou.URI_ID from " + URI_TABLE + " ou, " + URI_TABLE + " su, " + URI_TABLE + " au where 
ou.URI_STRING = ? and p.SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and p.ACTION_ID = 
au.URI_ID and au.URI_STRING = ? and p.VERSION_NO = ?)");
        "delete from " + PERMISSIONS_TABLE + " p where p.OBJECT_ID in (select 
ou.URI_ID from " + URI_TABLE + " ou, " + URI_TABLE + " su, " + URI_TABLE + " au where 
ou.URI_STRING = ? and p.SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and p.ACTION_ID = 
au.URI_ID and au.URI_STRING = ? and p.VERSION_NO" + ((revisionNumber == null) ? " IS 
NULL " : " = '" + revisionNumber.toString() + "'"));
          //fix:end
          statement.setString(1, permission.getObjectUri());
          statement.setString(2, permission.getSubjectUri());
          statement.setString(3, permission.getActionUri());
          //fix:begin: commented out because bind is no longer required
          //statement.setString(4, revisionNumber.toString());
          //fix:end:
          statement.executeUpdate();
    } catch (SQLException e) {
      throw createException(e, uri.toString());
    } finally {
      close(statement);
   }
}

 


Carlos Villegas <[EMAIL PROTECTED]> wrote:
Var George wrote:

> 2. public void revokePermissions(Connection connection, Uri uri) throws 
> ServiceAccessException method on CommonRDBMSAdaper seems to be redundant but 
> interestingly here the SQL logic different in CommonRDBMSAdaper & 
> StandardRDBMSAdaper (why?). 
> 
> -- StandardRDMBSAdaper: delete PERMISSIONS from PERMISSIONS, URI u where OBJECT_ID = 
> u.URI_ID and u.URI_STRING = ?");
> 
> -- CommonRDBMSAdaper : delete from PERMISSIONS where PERMISSIONS.OBJECT_ID in 
> (select u.URI_ID from URI u where u.URI_STRING = ?

I think these two SQL fragments do exactly the same thing, except that 
the one in StandardRDMBSAdapter is valid for MySQL and MSSQL (I think) 
and the one in CommonRDBMSAdapter is valid for PostgreSQL and other 
databases. I think the latter is SQL99 compatible and so should be in 
the most generic class.

Carlos

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


                
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Reply via email to