Why not doing something like
statement.setString(4, revisionNumber == null ? null :
revisionNumber.toString());
Oliver
On Thu, 21 Oct 2004 13:38:07 -0700 (PDT), Var George
<[EMAIL PROTECTED]> wrote:
> Oliver
>
> Yes, they are different SQL and I missed it. However in StandardDBMSAdapter there is
> null check for >>>revisionNumber<<< where as the same is missing in
> CommonsRDBMSAdapter. You will notice that the SQL has 3 bind variables in
> StandardDBMSAdapter where as it has 4 bind variables in CommonsRDBMSAapter.
>
> Here is the fixed SQL with fixes marked between //fix:start and //fix:end. Please
> fix it in slide cvs if possible.
>
> 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 p where p.OBJECT_ID in
> (select ou.URI_ID from URI ou, URI su, URI 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);
> }
> }
>
> regards
> Varughese George
>
> Oliver Zeigermann <[EMAIL PROTECTED]> wrote:
> On Wed, 20 Oct 2004 23:58:39 -0700 (PDT), Var George
> wrote:
> >
> > 1. public void revokePermission(Connection connection, Uri uri, NodePermission
> > permission) method in CommonRDBMSAdaper seems to be buggy where as this issue is
> > fixed in the same method on StandardRDBMSAdaper.java. Is there any reason why this
> > method is overridden is CommonRDBMSAdaper .java? They seems to be doing the same
> > thing except that the one on CommonRDBMSAdaper.java is buggy because it doesn't do
> > null check on revisionNumber.
>
> Except for the different SQL dialects both methods are the same, both
> start with
>
> if (permission == null) return;
>
> both in 2.1 as in the current CVS head. Am I missing something?
>
> Oliver
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile phone.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]