#
# Copyright The WildFly Authors
# SPDX-License-Identifier: Apache-2.0
#

create-table=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR NOT NULL, INITIAL_DATE TIMESTAMP, REPEAT_INTERVAL BIGINT, NEXT_DATE TIMESTAMP, PREVIOUS_RUN TIMESTAMP, PRIMARY_KEY VARCHAR, INFO VARCHAR, TIMER_STATE VARCHAR, SCHEDULE_EXPR_SECOND VARCHAR, SCHEDULE_EXPR_MINUTE VARCHAR, SCHEDULE_EXPR_HOUR VARCHAR,SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR, SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR, SCHEDULE_EXPR_MONTH VARCHAR, SCHEDULE_EXPR_YEAR VARCHAR, SCHEDULE_EXPR_START_DATE VARCHAR, SCHEDULE_EXPR_END_DATE VARCHAR, SCHEDULE_EXPR_TIMEZONE VARCHAR, AUTO_TIMER BOOLEAN, TIMEOUT_METHOD_DECLARING_CLASS VARCHAR, TIMEOUT_METHOD_NAME VARCHAR, TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER BOOLEAN, PARTITION_NAME VARCHAR NOT NULL, NODE_NAME VARCHAR)
create-timer=INSERT INTO JBOSS_EJB_TIMER (ID, TIMED_OBJECT_ID, INITIAL_DATE, REPEAT_INTERVAL, NEXT_DATE, PREVIOUS_RUN, PRIMARY_KEY, INFO, TIMER_STATE, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE, SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_OF_WEEK, SCHEDULE_EXPR_DAY_OF_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_YEAR, SCHEDULE_EXPR_START_DATE, SCHEDULE_EXPR_END_DATE, SCHEDULE_EXPR_TIMEZONE, AUTO_TIMER, TIMEOUT_METHOD_DECLARING_CLASS, TIMEOUT_METHOD_NAME, TIMEOUT_METHOD_DESCRIPTOR, CALENDAR_TIMER, PARTITION_NAME, NODE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
create-auto-timer=INSERT INTO JBOSS_EJB_TIMER (ID, TIMED_OBJECT_ID, NEXT_DATE, INFO, TIMER_STATE, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE, SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_OF_WEEK, SCHEDULE_EXPR_DAY_OF_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_YEAR, SCHEDULE_EXPR_START_DATE, SCHEDULE_EXPR_END_DATE, SCHEDULE_EXPR_TIMEZONE, AUTO_TIMER, TIMEOUT_METHOD_DECLARING_CLASS, TIMEOUT_METHOD_NAME, TIMEOUT_METHOD_DESCRIPTOR, CALENDAR_TIMER, PARTITION_NAME) SELECT ?, ?, ?, ?, 'CREATED', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? WHERE NOT EXISTS (SELECT 1 FROM JBOSS_EJB_TIMER WHERE TIMED_OBJECT_ID=? AND SCHEDULE_EXPR_SECOND=? AND SCHEDULE_EXPR_MINUTE=? AND SCHEDULE_EXPR_HOUR=? AND SCHEDULE_EXPR_DAY_OF_WEEK=? AND SCHEDULE_EXPR_DAY_OF_MONTH=? AND SCHEDULE_EXPR_MONTH=? AND SCHEDULE_EXPR_YEAR=? AND ((SCHEDULE_EXPR_START_DATE IS NULL AND ? IS NULL) OR SCHEDULE_EXPR_START_DATE=?) AND ((SCHEDULE_EXPR_END_DATE IS NULL AND ? IS NULL) OR SCHEDULE_EXPR_END_DATE=?) AND ((SCHEDULE_EXPR_TIMEZONE IS NULL AND ? IS NULL) OR SCHEDULE_EXPR_TIMEZONE=?) AND TIMEOUT_METHOD_DECLARING_CLASS=? AND TIMEOUT_METHOD_NAME=? AND ((TIMEOUT_METHOD_DESCRIPTOR IS NULL AND ? IS NULL) OR TIMEOUT_METHOD_DESCRIPTOR=?) AND PARTITION_NAME=?)
update-timer=UPDATE JBOSS_EJB_TIMER SET NEXT_DATE=?, PREVIOUS_RUN=?, TIMER_STATE=?, NODE_NAME=? WHERE TIMED_OBJECT_ID=? and ID=? AND PARTITION_NAME=? AND (NODE_NAME IS NULL OR NODE_NAME=?)
delete-timer=DELETE FROM JBOSS_EJB_TIMER WHERE TIMED_OBJECT_ID=? and ID=? AND PARTITION_NAME=?
load-all-timers=SELECT ID, TIMED_OBJECT_ID, INITIAL_DATE, REPEAT_INTERVAL, NEXT_DATE, PREVIOUS_RUN, PRIMARY_KEY, INFO, TIMER_STATE, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE, SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_OF_WEEK, SCHEDULE_EXPR_DAY_OF_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_YEAR, SCHEDULE_EXPR_START_DATE, SCHEDULE_EXPR_END_DATE, SCHEDULE_EXPR_TIMEZONE, AUTO_TIMER, TIMEOUT_METHOD_DECLARING_CLASS, TIMEOUT_METHOD_NAME, TIMEOUT_METHOD_DESCRIPTOR, CALENDAR_TIMER, NODE_NAME FROM JBOSS_EJB_TIMER WHERE TIMED_OBJECT_ID=? AND PARTITION_NAME=?
load-timer=SELECT ID, TIMED_OBJECT_ID, INITIAL_DATE, REPEAT_INTERVAL, NEXT_DATE, PREVIOUS_RUN, PRIMARY_KEY, INFO, TIMER_STATE, SCHEDULE_EXPR_SECOND, SCHEDULE_EXPR_MINUTE, SCHEDULE_EXPR_HOUR, SCHEDULE_EXPR_DAY_OF_WEEK, SCHEDULE_EXPR_DAY_OF_MONTH, SCHEDULE_EXPR_MONTH, SCHEDULE_EXPR_YEAR, SCHEDULE_EXPR_START_DATE, SCHEDULE_EXPR_END_DATE, SCHEDULE_EXPR_TIMEZONE, AUTO_TIMER, TIMEOUT_METHOD_DECLARING_CLASS, TIMEOUT_METHOD_NAME, TIMEOUT_METHOD_DESCRIPTOR, CALENDAR_TIMER, NODE_NAME FROM JBOSS_EJB_TIMER WHERE TIMED_OBJECT_ID=? and ID=? AND PARTITION_NAME=?
create-table.hsql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR NOT NULL, INITIAL_DATE TIMESTAMP, REPEAT_INTERVAL BIGINT, NEXT_DATE TIMESTAMP, PREVIOUS_RUN TIMESTAMP, PRIMARY_KEY VARCHAR, INFO VARCHAR, TIMER_STATE VARCHAR, SCHEDULE_EXPR_SECOND VARCHAR, SCHEDULE_EXPR_MINUTE VARCHAR, SCHEDULE_EXPR_HOUR VARCHAR,SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR, SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR, SCHEDULE_EXPR_MONTH VARCHAR, SCHEDULE_EXPR_YEAR VARCHAR, SCHEDULE_EXPR_START_DATE VARCHAR, SCHEDULE_EXPR_END_DATE VARCHAR, SCHEDULE_EXPR_TIMEZONE VARCHAR, AUTO_TIMER BOOLEAN, TIMEOUT_METHOD_DECLARING_CLASS VARCHAR, TIMEOUT_METHOD_NAME VARCHAR, TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER BOOLEAN, PARTITION_NAME VARCHAR NOT NULL, NODE_NAME VARCHAR);CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.postgresql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR NOT NULL, INITIAL_DATE TIMESTAMP, REPEAT_INTERVAL BIGINT, NEXT_DATE TIMESTAMP, PREVIOUS_RUN TIMESTAMP, PRIMARY_KEY VARCHAR, INFO TEXT, TIMER_STATE VARCHAR, SCHEDULE_EXPR_SECOND VARCHAR, SCHEDULE_EXPR_MINUTE VARCHAR, SCHEDULE_EXPR_HOUR VARCHAR,SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR, SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR, SCHEDULE_EXPR_MONTH VARCHAR, SCHEDULE_EXPR_YEAR VARCHAR, SCHEDULE_EXPR_START_DATE VARCHAR, SCHEDULE_EXPR_END_DATE VARCHAR, SCHEDULE_EXPR_TIMEZONE VARCHAR, AUTO_TIMER BOOLEAN, TIMEOUT_METHOD_DECLARING_CLASS VARCHAR, TIMEOUT_METHOD_NAME VARCHAR, TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER BOOLEAN, PARTITION_NAME VARCHAR NOT NULL, NODE_NAME VARCHAR);CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.mysql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR(255) NOT NULL, INITIAL_DATE DATETIME, REPEAT_INTERVAL BIGINT, NEXT_DATE DATETIME, PREVIOUS_RUN DATETIME, PRIMARY_KEY VARCHAR(255), INFO TEXT, TIMER_STATE VARCHAR(32), SCHEDULE_EXPR_SECOND VARCHAR(100), SCHEDULE_EXPR_MINUTE VARCHAR(100), SCHEDULE_EXPR_HOUR VARCHAR(100),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR(100), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR(100), SCHEDULE_EXPR_MONTH VARCHAR(100), SCHEDULE_EXPR_YEAR VARCHAR(100), SCHEDULE_EXPR_START_DATE VARCHAR(100), SCHEDULE_EXPR_END_DATE VARCHAR(100), SCHEDULE_EXPR_TIMEZONE VARCHAR(100), AUTO_TIMER BOOLEAN, TIMEOUT_METHOD_NAME VARCHAR(100), TIMEOUT_METHOD_DECLARING_CLASS VARCHAR(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER BOOLEAN, PARTITION_NAME VARCHAR(100) NOT NULL, NODE_NAME VARCHAR(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.mariadb=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR(255) NOT NULL, INITIAL_DATE DATETIME, REPEAT_INTERVAL BIGINT, NEXT_DATE DATETIME, PREVIOUS_RUN DATETIME, PRIMARY_KEY VARCHAR(255), INFO TEXT, TIMER_STATE VARCHAR(32), SCHEDULE_EXPR_SECOND VARCHAR(100), SCHEDULE_EXPR_MINUTE VARCHAR(100), SCHEDULE_EXPR_HOUR VARCHAR(100),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR(100), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR(100), SCHEDULE_EXPR_MONTH VARCHAR(100), SCHEDULE_EXPR_YEAR VARCHAR(100), SCHEDULE_EXPR_START_DATE VARCHAR(100), SCHEDULE_EXPR_END_DATE VARCHAR(100), SCHEDULE_EXPR_TIMEZONE VARCHAR(100), AUTO_TIMER BOOLEAN, TIMEOUT_METHOD_NAME VARCHAR(100), TIMEOUT_METHOD_DECLARING_CLASS VARCHAR(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER BOOLEAN, PARTITION_NAME VARCHAR(100) NOT NULL, NODE_NAME VARCHAR(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.oracle=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR2(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR2(255) NOT NULL, INITIAL_DATE TIMESTAMP, REPEAT_INTERVAL NUMBER(20), NEXT_DATE TIMESTAMP, PREVIOUS_RUN TIMESTAMP, PRIMARY_KEY VARCHAR2(255), INFO CLOB, TIMER_STATE VARCHAR2(32), SCHEDULE_EXPR_SECOND VARCHAR2(100), SCHEDULE_EXPR_MINUTE VARCHAR2(100), SCHEDULE_EXPR_HOUR VARCHAR2(100),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR2(100), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR2(100), SCHEDULE_EXPR_MONTH VARCHAR2(100), SCHEDULE_EXPR_YEAR VARCHAR2(100), SCHEDULE_EXPR_START_DATE VARCHAR2(100), SCHEDULE_EXPR_END_DATE VARCHAR(100), SCHEDULE_EXPR_TIMEZONE VARCHAR2(100), AUTO_TIMER NUMBER(1), TIMEOUT_METHOD_NAME VARCHAR2(100), TIMEOUT_METHOD_DECLARING_CLASS VARCHAR2(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER NUMBER(1), PARTITION_NAME VARCHAR2(100), NODE_NAME VARCHAR2(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.db2=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR(255) NOT NULL, INITIAL_DATE TIMESTAMP, REPEAT_INTERVAL BIGINT, NEXT_DATE TIMESTAMP, PREVIOUS_RUN TIMESTAMP, PRIMARY_KEY VARCHAR(255), INFO CLOB, TIMER_STATE VARCHAR(32), SCHEDULE_EXPR_SECOND VARCHAR(100), SCHEDULE_EXPR_MINUTE VARCHAR(100), SCHEDULE_EXPR_HOUR VARCHAR(100),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR(100), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR(100), SCHEDULE_EXPR_MONTH VARCHAR(100), SCHEDULE_EXPR_YEAR VARCHAR(100), SCHEDULE_EXPR_START_DATE VARCHAR(100), SCHEDULE_EXPR_END_DATE VARCHAR(100), SCHEDULE_EXPR_TIMEZONE VARCHAR(100), AUTO_TIMER INT, TIMEOUT_METHOD_NAME VARCHAR(100), TIMEOUT_METHOD_DECLARING_CLASS VARCHAR(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER INT, PARTITION_NAME VARCHAR(100) NOT NULL, NODE_NAME VARCHAR(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.mssql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR(255) NOT NULL, INITIAL_DATE DATETIME2, REPEAT_INTERVAL BIGINT, NEXT_DATE DATETIME2, PREVIOUS_RUN DATETIME2, PRIMARY_KEY VARCHAR(255), INFO VARCHAR(8000), TIMER_STATE VARCHAR(255), SCHEDULE_EXPR_SECOND VARCHAR(255), SCHEDULE_EXPR_MINUTE VARCHAR(255), SCHEDULE_EXPR_HOUR VARCHAR(255),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR(255), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR(255), SCHEDULE_EXPR_MONTH VARCHAR(255), SCHEDULE_EXPR_YEAR VARCHAR(255), SCHEDULE_EXPR_START_DATE VARCHAR(255), SCHEDULE_EXPR_END_DATE VARCHAR(255), SCHEDULE_EXPR_TIMEZONE VARCHAR(255), AUTO_TIMER SMALLINT, TIMEOUT_METHOD_DECLARING_CLASS VARCHAR(255), TIMEOUT_METHOD_NAME VARCHAR(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER SMALLINT, PARTITION_NAME VARCHAR(100) NOT NULL, NODE_NAME VARCHAR(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
create-table.sybase=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL, TIMED_OBJECT_ID VARCHAR(255) NOT NULL, INITIAL_DATE DATETIME, REPEAT_INTERVAL BIGINT, NEXT_DATE DATETIME, PREVIOUS_RUN DATETIME, PRIMARY_KEY VARCHAR(255), INFO VARCHAR(16384), TIMER_STATE VARCHAR(255), SCHEDULE_EXPR_SECOND VARCHAR(255), SCHEDULE_EXPR_MINUTE VARCHAR(255), SCHEDULE_EXPR_HOUR VARCHAR(255),SCHEDULE_EXPR_DAY_OF_WEEK VARCHAR(255), SCHEDULE_EXPR_DAY_OF_MONTH VARCHAR(255), SCHEDULE_EXPR_MONTH VARCHAR(255), SCHEDULE_EXPR_YEAR VARCHAR(255), SCHEDULE_EXPR_START_DATE VARCHAR(255), SCHEDULE_EXPR_END_DATE VARCHAR(255), SCHEDULE_EXPR_TIMEZONE VARCHAR(255), AUTO_TIMER SMALLINT, TIMEOUT_METHOD_DECLARING_CLASS VARCHAR(255), TIMEOUT_METHOD_NAME VARCHAR(255), TIMEOUT_METHOD_DESCRIPTOR CHAR(1), CALENDAR_TIMER SMALLINT, PARTITION_NAME VARCHAR(100) NOT NULL, NODE_NAME VARCHAR(255));CREATE INDEX JBOSS_EJB_TIMER_IDENX ON JBOSS_EJB_TIMER (PARTITION_NAME, TIMED_OBJECT_ID)
update-running=UPDATE JBOSS_EJB_TIMER SET TIMER_STATE=?, NODE_NAME=? WHERE ID=? AND TIMER_STATE<>? AND TIMER_STATE<>? AND NEXT_DATE<=?
get-timer-info=SELECT INFO FROM JBOSS_EJB_TIMER WHERE TIMED_OBJECT_ID=? and ID=?