public boolean updatePostTimestamps ( long postId , final long publishTimestamp , final long modifiedTimestamp , final TimeZone tz ) throws SQLException { int offset = tz . getOffset ( publishTimestamp ) ; Connection conn = null ; PreparedStatement stmt = null ; Timer . Context ctx = metrics . updatePostTimer . time ( ) ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostTimestampsSQL ) ; stmt . setTimestamp ( 1 , new Timestamp ( publishTimestamp ) ) ; stmt . setTimestamp ( 2 , new Timestamp ( publishTimestamp - offset ) ) ; stmt . setTimestamp ( 3 , new Timestamp ( modifiedTimestamp ) ) ; stmt . setTimestamp ( 4 , new Timestamp ( modifiedTimestamp - offset ) ) ; stmt . setLong ( 5 , postId ) ; return stmt . executeUpdate ( ) > 0 ; } finally { ctx . stop ( ) ; SQLUtil . closeQuietly ( conn , stmt ) ; } }
Updates only the timestamp fields for a post .