public void clearHistory ( int profileId , String clientUUID ) { PreparedStatement query = null ; try ( Connection sqlConnection = sqlService . getConnection ( ) ) { String sqlQuery = "DELETE FROM " + Constants . DB_TABLE_HISTORY + " " ; // see if profileId is null or not (-1) if ( profileId != - 1 ) { sqlQuery += "WHERE " + Constants . GENERIC_PROFILE_ID + "=" + profileId ; } // see if clientUUID is null or not if ( clientUUID != null && clientUUID . compareTo ( "" ) != 0 ) { sqlQuery += " AND " + Constants . GENERIC_CLIENT_UUID + "='" + clientUUID + "'" ; } sqlQuery += ";" ; logger . info ( "Query: {}" , sqlQuery ) ; query = sqlConnection . prepareStatement ( sqlQuery ) ; query . executeUpdate ( ) ; } catch ( Exception e ) { } finally { try { if ( query != null ) { query . close ( ) ; } } catch ( Exception e ) { } } }
Clear history for a client