chapter_006/src/main/java/ru/job4j/store/StoreSQL.java
/**
     * Check the table for records.
     * If there are records in the table, all records are deleted.
     */
Check the table for records.
If there are records in the table, all records are deleted.
Check the table for records . If there are records in the table all records are deleted .
private void checkRecords() {
        this.st = null;
        this.rs = null;
        try {
            this.st = conn.prepareStatement(SELECT_ELEMENT);
            this.rs = this.st.executeQuery();
            if (this.rs.next()) {
                this.st = conn.prepareStatement("DELETE FROM entry;");
                st.executeUpdate();
            }
        } catch (SQLException e) {
            try {
                this.conn.rollback();
            } catch (SQLException e1) {
                e1.printStackTrace();
            }
            LOGGER.error(e.getMessage(), e);
        }
    }
private void checkRecords ( ) { this . st = null ; this . rs = null ; try { this . st = conn . prepareStatement ( SELECT_ELEMENT ) ; this . rs = this . st . executeQuery ( ) ; if ( this . rs . next ( ) ) { this . st = conn . prepareStatement ( "DELETE FROM entry;" ) ; st . executeUpdate ( ) ; } } catch ( SQLException e ) { try { this . conn . rollback ( ) ; } catch ( SQLException e1 ) { e1 . printStackTrace ( ) ; } LOGGER . error ( e . getMessage ( ) , e ) ; } }
Check the table for records.
Check the table for records .