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

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

There is a newer version: 6.4
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">
        INSERT INTO check_log (day, date, matches, textsize, user_id, language, server, client,
        language_detected, computation_time, text_session_id, check_mode) VALUES
        (#{day}, #{date}, #{matches}, #{textsize}, #{user_id}, #{language}, #{server}, #{client},
        #{language_detected}, #{computation_time}, #{text_session_id}, #{check_mode})
    </insert>
    <insert id="pings">
        INSERT INTO pings (day, created_at, client, user_id)
        VALUES (#{day}, #{created_at}, #{client}, #{user_id})
    </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,
        check_mode varchar(32),
        day DATE
        )
    </insert>
    <insert id="createCheckLogMySQL">
        CREATE TABLE IF NOT EXISTS `check_log` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `date` datetime NOT NULL,
        `matches` int(10) unsigned NOT NULL,
        `textsize` int(10) unsigned NOT NULL,
        `user_id` int(10) unsigned DEFAULT NULL,
        `language` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'language code provided by client, e.g.
        de-DE',
        `server` int(10) unsigned DEFAULT NULL COMMENT 'host name of server responsible for this request',
        `client` int(10) unsigned DEFAULT NULL COMMENT 'client responsible for this request, e.g. browser
        addon/website/word',
        `language_detected` varchar(8) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'language code as detected by
        server',
        `computation_time` int(10) DEFAULT NULL COMMENT 'request handling time in milliseconds',
        `text_session_id` int(10) unsigned DEFAULT NULL COMMENT 'randomly generated number consistent across editing and
        check actions',
        `day` date NOT NULL,
        `check_mode` varchar(32),
        PRIMARY KEY (`id`),
        KEY `date_index` (`date`),
        KEY `date_user_index` (`date`,`user_id`)
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
    </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="createServersMySQL">
        CREATE TABLE IF NOT EXISTS `servers` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `hostname` varchar(64) NOT NULL,
        PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8

    </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="createClientsMySQL">
        CREATE TABLE IF NOT EXISTS `clients` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `name` varchar(64) NOT NULL,
        PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8

    </insert>

    <insert id="createPings">
        create table if not exists pings (
        id BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
        day date NOT NULL,
        created_at datetime NOT NULL,
        client INTEGER NOT NULL,
        user_id INTEGER NOT NULL
        )
    </insert>
    <insert id="createPingsMySQL">
        CREATE TABLE `pings` (
        `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
        `user_id` int(10) unsigned NOT NULL,
        `client` int(10) unsigned NOT NULL,
        `day` date NOT NULL,
        `created_at` timestamp NULL DEFAULT NULL,
        PRIMARY KEY (`id`)
        ) ENGINE=MyISAM DEFAULT CHARSET=utf8
    </insert>

    <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="dropPings">
        drop table if exists pings;
    </delete>
</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy