public ResultSet executeQuery() throws SQLException {

            Instant start = Instant.now();
            ResultSet result = pstmt.executeQuery();
            Instant end = Instant.now();

            switch (type) {
                case select:
                    addQuery(Type.select, sql, Duration.between(start, end));
                    break;
                case update:
                    addQuery(Type.update, sql, Duration.between(start, end));
                    break;
                case insert:
                    addQuery(Type.insert, sql, Duration.between(start, end));
                    break;
                case delete:
                    addQuery(Type.delete, sql, Duration.between(start, end));
                    break;
            }
            return result;
        }
An implementation of the PreparedStatement interface that wraps an
underlying PreparedStatement object and performs timings of the database
queries.
xmppserver/src/main/java/org/jivesoftware/database/ProfiledConnection.java