All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.languagetool.server.LogMapper.xml Maven / Gradle / Ivy

There is a newer version: 6.5
Show newest version
<?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="org.languagetool.server.LogMapper">

    <select id="findServer" resultType="_long">
        SELECT id from servers where hostname = #{hostname}
    </select>
    <insert id="newServer" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO servers (hostname) VALUES (#{hostname})
    </insert>
    <select id="findClient" resultType="_long">
        SELECT id from clients where name = #{name}
    </select>
    <insert id="newClient" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO clients (name) VALUES (#{name})
    </insert>

    <insert id="logCheck" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO check_log (day, date, matches, textsize, user_id, language, server, client,
        language_detected, computation_time, text_session_id) VALUES
            (#{day}, #{date}, #{matches}, #{textsize}, #{user_id}, #{language}, #{server}, #{client},
            #{language_detected}, #{computation_time}, #{text_session_id})
    </insert>
    <insert id="ruleMatch">
       INSERT INTO rule_matches (check_id, rule_id, match_count) VALUES
            (#{check_id}, #{rule_id}, #{match_count})
    </insert>
    <insert id="cacheStats">
       INSERT INTO cache_stats (date, server, cache_hits)
            VALUES (#{date}, #{server}, #{cache_hits})
    </insert>
    <insert id="miscLogs">
        INSERT INTO misc_log (date, server, client, user, message)
            VALUES (#{date}, #{server}, #{client}, #{user}, #{message})
    </insert>
    <insert id="checkError">
        INSERT INTO check_error (type, date, server, client, user, language, language_detected, text_length, extra)
            VALUES (#{type}, #{date}, #{server}, #{client}, #{user}, #{language}, #{language_detected}, #{text_length}, #{extra})
    </insert>
    <insert id="accessLimit">
        INSERT INTO access_limits (type, date, server, client, user, referrer, user_agent, reason)
            VALUES (#{type}, #{date}, #{server}, #{client}, #{user}, #{referrer}, #{user_agent}, #{reason})
    </insert>

    <insert id="createRuleMatches">
        CREATE TABLE if not exists rule_matches (
            match_id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
            check_id INTEGER,
            rule_id VARCHAR(64),
            match_count INTEGER
        )
    </insert>

    <insert id="createCheckLog">
        CREATE TABLE if not exists check_log (
            id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
            date DATETIME,
            matches INTEGER,
            textsize INTEGER,
            user_id INTEGER,
            language VARCHAR(8),
            server INTEGER,
            client INTEGER,
            language_detected VARCHAR(8),
            computation_time INTEGER,
            text_session_id INTEGER,
            day DATE
        )
    </insert>

    <insert id="createServers">
        create table if not exists servers (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        hostname varchar(64)
        )
    </insert>

    <insert id="createClients">
        create table if not exists clients (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        name varchar(64)
        )
    </insert>

    <insert id="createCacheStats">
        create table if not exists cache_stats (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        date datetime,
        server INTEGER,
        cache_hits float
        )
    </insert>

    <insert id="createMiscLog">
        create table if not exists misc_log (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        date datetime,
        server INTEGER,
        client INTEGER,
        user INTEGER,
        message varchar(1024)
        )
    </insert>

    <insert id="createCheckError">
        create table if not exists check_error (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        type varchar(64),
        date datetime,
        server INTEGER,
        client INTEGER,
        user INTEGER,
        language varchar(8),
        language_detected varchar(8),
        text_length INTEGER,
        extra varchar(256)
        )
    </insert>

    <insert id="createAccessLimits">
        create table if not exists access_limits (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        type varchar(64),
        date datetime,
        server INTEGER,
        client INTEGER,
        user INTEGER,
        referrer varchar(128),
        user_agent varchar(512),
        reason varchar(128)
        )
    </insert>

    <delete id="dropRuleMatches">
        drop table if exists rule_matches;
    </delete>
    <delete id="dropCheckLog">
        drop table if exists check_log;
    </delete>
    <delete id="dropServers">
        drop table if exists servers;
    </delete>
    <delete id="dropClients">
        drop table if exists clients;
    </delete>
    <delete id="dropCacheStats">
        drop table if exists cache_stats;
    </delete>
    <delete id="dropMiscLog">
        drop table if exists misc_log;
    </delete>
    <delete id="dropCheckError">
        drop table if exists check_error;
    </delete>
    <delete id="dropAccessLimits">
        drop table if exists access_limits;
    </delete>
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy