Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.languagetool.server.LogMapper.xml Maven / Gradle / Ivy
<?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="ruleMatch">
INSERT INTO rule_matches (check_id, rule_id, match_count) VALUES
<foreach item="match" collection="matches" separator=",">
(LAST_INSERT_ID(), #{match.ruleId}, #{match.matchCount})
</foreach>
</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="pings">
INSERT INTO pings (day, created_at, client, user_id)
VALUES (#{day}, #{created_at}, #{client}, #{user_id})
</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="createRuleMatchesMySQL">
CREATE TABLE IF NOT EXISTS `rule_matches` (
`match_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key, one for each matching rule in a
check',
`check_id` int(10) unsigned NOT NULL COMMENT 'foreign key, referencing corresponding row in check_log',
`rule_id` varchar(128) NOT NULL COMMENT 'name of the rule as defined in Java/XML code',
`match_count` int(10) unsigned NOT NULL COMMENT 'number of matches in the text',
PRIMARY KEY (`match_id`),
KEY `check_index` (`check_id`),
KEY `rule_index` (`rule_id`)
) DEFAULT CHARSET=utf8
</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="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="createCacheStatsMySQL">
CREATE TABLE IF NOT EXISTS `cache_stats` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`server` int(10) unsigned NOT NULL,
`cache_hits` float NOT NULL,
PRIMARY KEY (`id`),
KEY `date_index` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
</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="createMiscLogMySQL">
CREATE TABLE IF NOT EXISTS `misc_log` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`date` datetime NOT NULL,
`server` int(10) unsigned DEFAULT NULL,
`client` int(10) unsigned DEFAULT NULL,
`user` int(10) unsigned DEFAULT NULL,
`message` varchar(1024) NOT NULL,
PRIMARY KEY (`id`),
KEY `date_index` (`date`)
) 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>
<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="createCheckErrorMySQL">
CREATE TABLE IF NOT EXISTS `check_error` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(64) NOT NULL,
`date` datetime NOT NULL,
`server` int(10) unsigned DEFAULT NULL,
`client` int(10) unsigned DEFAULT NULL,
`user` int(10) unsigned DEFAULT NULL,
`language_set` varchar(8) DEFAULT NULL,
`language_detected` varchar(8) DEFAULT NULL,
`text_length` int(10) unsigned DEFAULT NULL,
`extra` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `date_index` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
</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>
<insert id="createAccessLimitsMySQL">
CREATE TABLE IF NOT EXISTS `access_limits` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(64) NOT NULL,
`date` datetime NOT NULL,
`server` int(10) unsigned DEFAULT NULL,
`client` int(10) unsigned DEFAULT NULL,
`user` int(10) unsigned DEFAULT NULL,
`referrer` varchar(128) DEFAULT NULL,
`user_agent` varchar(512) DEFAULT NULL,
`reason` varchar(128) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `date_index` (`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
</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="dropPings">
drop table if exists pings;
</delete>
<delete id="dropCheckError">
drop table if exists check_error;
</delete>
<delete id="dropAccessLimits">
drop table if exists access_limits;
</delete>
</mapper>