queries:
  -
   mappings:
      CREATE_TABLE:
      INSERT:
      IS_TABLE_EXIST:
      SELECT:
      MINIMAL_SELECT:
      SELECT_SINGLE:
      SELECT_COUNT:
      SELECT_WITH_LIMIT_OFFSET:
      MINIMAL_SELECT_WITH_LIMIT_OFFSET:
      DELETE:
      SELECT_COUNT_BY_SIDDHI_APP_NAME:
      DELETE_BY_SIDDHI_APP_NAME:
      PURGE:

   type: default
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT * FROM {{TABLE_NAME}} limit 1
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL AUTO_INCREMENT, timestamp BIGINT, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event LONGBLOB, cause VARCHAR(1000), stackTrace LONGBLOB, originalPayload LONGBLOB, errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50), PRIMARY KEY (id))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? limit ? offset ?
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? limit ? offset ?
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: h2
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT * FROM {{TABLE_NAME}} limit 1
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL AUTO_INCREMENT, timestamp BIGINT, siddhiAppName VARCHAR (100), streamName VARCHAR(100), event LONGBLOB, cause VARCHAR(1000), stackTrace LONGBLOB, originalPayload LONGBLOB, errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50), PRIMARY KEY (id))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: mysql
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT 1 FROM {{TABLE_NAME}} LIMIT 1
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id serial primary key, timestamp bigint, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event bigint, cause VARCHAR(1000), stackTrace bigint, originalPayload bigint, errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: postgresql
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT TOP 1 1 FROM {{TABLE_NAME}}
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INT NOT NULL IDENTITY(1,1) PRIMARY KEY, timestamp bigint, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event VARBINARY(max), cause VARCHAR(1000), stackTrace VARBINARY(max), originalPayload VARBINARY(max), errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: microsoft sql server
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT 1 FROM {{TABLE_NAME}} WHERE rownum=1
     # Below CREATE_TABLE query is valid for oracle 12 or higher only. If using with lower version need to run create table query manually in below format.
     # eg: CREATE TABLE SIDDHI_ERROR_STORE_TABLE (id NUMBER(10) NOT NULL, timestamp LONG, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event BLOB, cause VARCHAR(1000), stackTrace BLOB, originalPayload BLOB, errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50)); ALTER TABLE SIDDHI_ERROR_STORE_TABLE ADD (CONSTRAINT err_store_pk PRIMARY KEY (id)); CREATE SEQUENCE err_store_seq START WITH 1; CREATE OR REPLACE TRIGGER err_store_trigger BEFORE INSERT ON SIDDHI_ERROR_STORE_TABLE FOR EACH ROW BEGIN SELECT err_store_seq.NEXTVAL INTO   :new.id FROM   dual; END;
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id NUMBER(10) GENERATED ALWAYS as IDENTITY(START with 1 INCREMENT by 1) NOT NULL, timestamp LONG, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event BLOB, cause VARCHAR(1000), stackTrace BLOB, originalPayload BLOB, errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? OFFSET ? ROWS FETCH NEXT ? ROWS ONLY
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: oracle
   version: default

  -
   mappings:
     IS_TABLE_EXIST: SELECT * FROM {{TABLE_NAME}} FETCH FIRST 1 ROWS ONLY
     CREATE_TABLE: CREATE TABLE {{TABLE_NAME}} (id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, timestamp BIGINT, siddhiAppName VARCHAR(100), streamName VARCHAR(100), event BLOB(2000000000), cause VARCHAR(1000), stackTrace BLOB(2000000000), originalPayload BLOB(2000000000), errorOccurrence VARCHAR(50), eventType VARCHAR(50), errorType VARCHAR(50), PRIMARY KEY (id))
     INSERT: INSERT INTO {{TABLE_NAME}} (timestamp, siddhiAppName, streamName, event, cause, stackTrace, originalPayload, errorOccurrence, eventType, errorType) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
     SELECT: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_SINGLE: SELECT * FROM {{TABLE_NAME}} WHERE id = ?
     MINIMAL_SELECT: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     SELECT_WITH_LIMIT_OFFSET: SELECT * FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     MINIMAL_SELECT_WITH_LIMIT_OFFSET: SELECT id, timestamp, siddhiAppName, streamName, cause, errorOccurrence, eventType, errorType FROM {{TABLE_NAME}} WHERE siddhiAppName = ? LIMIT ? OFFSET ?
     SELECT_COUNT: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}}
     DELETE: DELETE FROM {{TABLE_NAME}} WHERE id = ?
     SELECT_COUNT_BY_SIDDHI_APP_NAME: SELECT COUNT(*) AS entriesCount FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     DELETE_BY_SIDDHI_APP_NAME: DELETE FROM {{TABLE_NAME}} WHERE siddhiAppName = ?
     PURGE: DELETE FROM {{TABLE_NAME}} WHERE timestamp < ?

   type: db2
   version: default
