<commit_before><?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.cfp.mapper.CommentMapper">

    <insert id="insert" parameterType="io.cfp.model.Comment"
            useGeneratedKeys="true" keyProperty="id" keyColumn="id">
        insert into comments (comment, added, internal, proposal, user, event_id)
        values (#{comment}, #{added}, #{internal}, #{proposalId}, #{user.id}, #{eventId})
    </insert>

    <select id="findByEventAndProposal" parameterType="io.cfp.model.queries.CommentQuery" resultType="io.cfp.model.Comment">
        SELECT * FROM comments
        WHERE event_id = #{eventId}
        AND proposal = #{proposalId}
        <if test="internal == false">
            AND internal = #{internal};
        </if>
    </select>

    <update id="update" parameterType="io.cfp.model.Comment">
        UPDATE comments SET
            comment = #{comment},
            added = #{added}
        WHERE id = #{id}
        AND event_id = #{eventId}
        AND proposal = #{proposalId}
        AND user = #{user}
    </update>

    <delete id="delete" parameterType="io.cfp.model.Comment">
        DELETE FROM comments WHERE id = #{id} AND event_id = #{eventId} AND proposal = #{proposalId}
    </delete>

</mapper><commit_msg>user is a reserved SQL keyword 💣<commit_after><?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.cfp.mapper.CommentMapper">

    <insert id="insert" parameterType="io.cfp.model.Comment"
            useGeneratedKeys="true" keyProperty="id" keyColumn="id">
        insert into comments (comment, added, internal, proposal, user, event_id)
        values (#{comment}, #{added}, #{internal}, #{proposalId}, #{user.id}, #{eventId})
    </insert>

    <select id="findByEventAndProposal" parameterType="io.cfp.model.queries.CommentQuery" resultType="io.cfp.model.Comment">
        SELECT * FROM comments
        WHERE event_id = #{eventId}
        AND proposal = #{proposalId}
        <if test="internal == false">
            AND internal = #{internal};
        </if>
    </select>

    <update id="update" parameterType="io.cfp.model.Comment">
        UPDATE comments SET
            comment = #{comment},
            added = #{added}
        WHERE id = #{id}
        AND event_id = #{eventId}
        AND proposal = #{proposalId}
        AND `user` = #{user}
    </update>

    <delete id="delete" parameterType="io.cfp.model.Comment">
        DELETE FROM comments WHERE id = #{id}
        AND event_id = #{eventId}
        AND proposal = #{proposalId}
        AND `user` = #{user}
    </delete>

</mapper>
{'fraction_non_alphanumeric': 0.15946724262059037, 'fraction_numerical': 0.004319654427645789, 'mean_word_length': 2.843706777316736, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 2, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4037352', 'n_tokens_mistral': 880, 'n_tokens_neox': 845, 'n_words': 200}