private int primUpdate ( IPermission perm , PreparedStatement ps ) throws Exception { java . sql . Timestamp ts = null ; // UPDATE COLUMNS: ps . clearParameters ( ) ; // TYPE: if ( perm . getType ( ) == null ) { ps . setNull ( 1 , Types . VARCHAR ) ; } else { ps . setString ( 1 , perm . getType ( ) ) ; } // EFFECTIVE: if ( perm . getEffective ( ) == null ) { ps . setNull ( 2 , Types . TIMESTAMP ) ; } else { ts = new java . sql . Timestamp ( perm . getEffective ( ) . getTime ( ) ) ; ps . setTimestamp ( 2 , ts ) ; } // EXPIRES: if ( perm . getExpires ( ) == null ) { ps . setNull ( 3 , Types . TIMESTAMP ) ; } else { ts = new java . sql . Timestamp ( perm . getExpires ( ) . getTime ( ) ) ; ps . setTimestamp ( 3 , ts ) ; } // WHERE COLUMNS: ps . setString ( 4 , perm . getOwner ( ) ) ; ps . setInt ( 5 , getPrincipalType ( perm ) ) ; ps . setString ( 6 , getPrincipalKey ( perm ) ) ; ps . setString ( 7 , perm . getActivity ( ) ) ; ps . setString ( 8 , perm . getTarget ( ) ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "RDBMPermissionImpl.primUpdate(): " + ps ) ; return ps . executeUpdate ( ) ; }
Set the params on the PreparedStatement and execute the update .