org.jooq.Clause Maven / Gradle / Ivy
/**
* Copyright (c) 2009-2014, Data Geekery GmbH (http://www.datageekery.com)
* All rights reserved.
*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
* - If you're using this work with Open Source databases, you may choose
* either ASL or jOOQ License.
* - If you're using this work with at least one commercial database, you must
* choose jOOQ License
*
* For more information, please visit http://www.jooq.org/licenses
*
* Apache Software License 2.0:
* -----------------------------------------------------------------------------
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* jOOQ License and Maintenance Agreement:
* -----------------------------------------------------------------------------
* Data Geekery grants the Customer the non-exclusive, timely limited and
* non-transferable license to install and use the Software under the terms of
* the jOOQ License and Maintenance Agreement.
*
* This library is distributed with a LIMITED WARRANTY. See the jOOQ License
* and Maintenance Agreement for more details: http://www.jooq.org/licensing
*/
package org.jooq;
/**
* A listing of clauses that emit events {@link VisitListener}.
*
*
Disclaimer
This SPI is still experimental! Some SPI
* elements and/or behavioural elements may change in future minor releases.
*/
public enum Clause {
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model catalog references
// -------------------------------------------------------------------------
CATALOG,
CATALOG_REFERENCE,
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model schema references
// -------------------------------------------------------------------------
SCHEMA,
SCHEMA_REFERENCE,
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model sequence references
// -------------------------------------------------------------------------
SEQUENCE,
SEQUENCE_REFERENCE,
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model table references
// -------------------------------------------------------------------------
/**
* A table expression.
*
* This clause surrounds an actual table expression as it can be encountered
* in
*
* - {@link #SELECT_FROM}
* - {@link #INSERT_INSERT_INTO}
* - {@link #UPDATE_UPDATE}
* - {@link #DELETE_DELETE}
* - {@link #MERGE_MERGE_INTO}
* - {@link #TRUNCATE_TRUNCATE}
*
*/
TABLE,
/**
* A table alias declaration.
*
* This clause surrounds a table alias declaration, for instance within the
* {@link #SELECT_FROM} clause, or within a {@link #TABLE_JOIN} clause,
* wrapping another {@link #TABLE}.
*
* Referenced table aliases emit {@link #TABLE_REFERENCE} clauses.
*/
TABLE_ALIAS,
/**
* A physical or aliased table reference.
*
* This is a terminal clause used to reference physical or aliased tables.
*/
TABLE_REFERENCE,
TABLE_JOIN,
TABLE_JOIN_INNER,
TABLE_JOIN_CROSS,
TABLE_JOIN_NATURAL,
TABLE_JOIN_OUTER_LEFT,
TABLE_JOIN_OUTER_RIGHT,
TABLE_JOIN_OUTER_FULL,
TABLE_JOIN_NATURAL_OUTER_LEFT,
TABLE_JOIN_NATURAL_OUTER_RIGHT,
TABLE_JOIN_CROSS_APPLY,
TABLE_JOIN_OUTER_APPLY,
TABLE_JOIN_ON,
TABLE_JOIN_USING,
TABLE_JOIN_PARTITION_BY,
/**
* A VALUES
table constructor
*
* This clause surrounds a
*
* - a
VALUES
keyword
* - a table constructor with several {@link #FIELD_ROW} value expressions
*
*
*/
TABLE_VALUES,
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model column references
// -------------------------------------------------------------------------
/**
* A field expression.
*
* This clause surrounds an actual field expression as it can be encountered
* in various other clauses, such as for instance {@link #SELECT_SELECT}.
*/
FIELD,
/**
* A field alias declaration.
*
* This clause surrounds a field alias declaration, for instance within the
* {@link #SELECT_SELECT} clause, wrapping another {@link #FIELD}.
*
* Referenced field aliases emit {@link #FIELD_REFERENCE} clauses.
*/
FIELD_ALIAS,
/**
* A physical or aliased field reference.
*
* This is a terminal clause used to reference physical or aliased fields.
*/
FIELD_REFERENCE,
FIELD_VALUE,
FIELD_CASE,
FIELD_ROW,
FIELD_FUNCTION,
// -------------------------------------------------------------------------
// Clauses used in a any type of statement to model condition references
// -------------------------------------------------------------------------
/**
* A condition expression.
*/
CONDITION,
/**
* A NULL
condition.
*
* This clause surrounds a {@link #FIELD}.
*/
CONDITION_IS_NULL,
/**
* A NOT NULL
condition.
*
* This clause surrounds a {@link #FIELD}.
*/
CONDITION_IS_NOT_NULL,
// TODO: Should operators be distinguished?
// - LIKE predicate
// - Subselect predicates
// - RVE predicates
// - Quantified predicates
CONDITION_COMPARISON,
/**
* A BEWEEN
condition.
*
* This clause surrounds three {@link #FIELD} clauses.
*/
CONDITION_BETWEEN,
/**
* A BEWEEN SYMMETRIC
condition.
*
* This clause surrounds three {@link #FIELD} clauses.
*/
CONDITION_BETWEEN_SYMMETRIC,
/**
* A NOT BEWEEN
condition.
*
* This clause surrounds three {@link #FIELD} clauses.
*/
CONDITION_NOT_BETWEEN,
/**
* A NOT BEWEEN SYMMETRIC
condition.
*
* This clause surrounds three {@link #FIELD} clauses.
*/
CONDITION_NOT_BETWEEN_SYMMETRIC,
/**
* An OVERLAPS
condition.
*
* This clause surrounds two {@link #FIELD} clauses.
*/
CONDITION_OVERLAPS,
/**
* A combined condition using AND
.
*
* This clause surrounds several {@link #CONDITION} clauses.
*/
CONDITION_AND,
/**
* A combined condition using OR
.
*
* This clause surrounds several {@link #CONDITION} clauses.
*/
CONDITION_OR,
/**
* A NOT
condition.
*
* This clause surrounds a {@link #CONDITION} clause.
*/
CONDITION_NOT,
/**
* An IN
condition.
*
* This clause surrounds two or more {@link #FIELD} clauses.
*/
CONDITION_IN,
/**
* A NOT IN
condition.
*
* This clause surrounds two or more {@link #FIELD} clauses.
*/
CONDITION_NOT_IN,
/**
* An EXISTS
condition.
*
* This clause surrounds a {@link #SELECT} clause.
*/
CONDITION_EXISTS,
/**
* A NOT EXISTS
condition.
*
* This clause surrounds a {@link #SELECT} clause.
*/
CONDITION_NOT_EXISTS,
// -------------------------------------------------------------------------
// The WITH clause that is used in all sorts of statements
// -------------------------------------------------------------------------
/**
* A WITH
clause preceding all sorts of DML statements.
*/
WITH,
// -------------------------------------------------------------------------
// Clauses that are used in a SELECT statement
// -------------------------------------------------------------------------
/**
* A complete SELECT
statement or a subselect.
*
* This clause surrounds a complete SELECT
statement, a
* subselect, or a set operation, such as
*
* - {@link #SELECT_UNION}
* - {@link #SELECT_UNION_ALL}
* - {@link #SELECT_INTERSECT}
* - {@link #SELECT_EXCEPT}
*
*/
SELECT,
/**
* A UNION
set operation.
*
* This clause surrounds two or more subselects (see {@link #SELECT})
* concatenating them using a UNION
set operation.
*/
SELECT_UNION,
/**
* A UNION ALL
set operation.
*
* This clause surrounds two or more subselects (see {@link #SELECT})
* concatenating them using a UNION ALL
set operation.
*/
SELECT_UNION_ALL,
/**
* A INTERSECT
set operation.
*
* This clause surrounds two or more subselects (see {@link #SELECT})
* concatenating them using a INTERSECT
set operation.
*/
SELECT_INTERSECT,
/**
* A EXCEPT
set operation.
*
* This clause surrounds two or more subselects (see {@link #SELECT})
* concatenating them using a EXCEPT
set operation.
*/
SELECT_EXCEPT,
/**
* A SELECT
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
SELECT
keyword
* - Oracle style hints
* - the T-SQL style
TOP .. START AT
clause
* - the select field list
*
*/
SELECT_SELECT,
/**
* A INTO
clause within a {@link #SELECT} statement.
*
* This clause surrounds
*
* - the
INTO
keyword
* - the table reference
*
*
* See {@link #TABLE} and related clauses for possible table references.
*
* @see #TABLE
*/
SELECT_INTO,
/**
* A FROM
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
FROM
keyword
* - the table reference list
*
*
* See {@link #TABLE} and related clauses for possible table references.
*
* @see #TABLE
*/
SELECT_FROM,
/**
* A WHERE
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
WHERE
keyword
* - a {@link #CONDITION}
*
*
* See {@link #CONDITION} and related clauses for possible conditions
*
* @see #CONDITION
*/
SELECT_WHERE,
/**
* A START WITH
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
START WITH
keywords
* - a {@link #CONDITION}
*
*
* See {@link #CONDITION} and related clauses for possible conditions
*
* @see #CONDITION
*/
SELECT_START_WITH,
/**
* A CONNECT BY
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
CONNECT BY
keywords
* - a {@link #CONDITION}
*
*
* See {@link #CONDITION} and related clauses for possible conditions
*
* @see #CONDITION
*/
SELECT_CONNECT_BY,
SELECT_GROUP_BY,
/**
* A HAVING
clause within a {@link #SELECT} statement or
* subselect.
*
* This clause surrounds
*
* - the
HAVING
keyword
* - a {@link #CONDITION}
*
*
* See {@link #CONDITION} and related clauses for possible conditions
*
* @see #CONDITION
*/
SELECT_HAVING,
SELECT_WINDOW,
SELECT_ORDER_BY,
// -------------------------------------------------------------------------
// Clauses that are used in an INSERT statement
// -------------------------------------------------------------------------
/**
* A complete INSERT
statement.
*/
INSERT,
/**
* The INSERT INTO
clause within an {@link #INSERT} statement.
*
* This clause surrounds
*
* - the
INSERT INTO
keywords
* - the table that is being inserted
*
*/
INSERT_INSERT_INTO,
/**
* The VALUES
clause within an {@link #INSERT} statement.
*
* This clause surrounds
*
* - the
VALUES
keyword
* - several {@link #FIELD_ROW} clauses
*
*/
INSERT_VALUES,
/**
* The SELECT
clause within an {@link #INSERT} statement.
*
* This clause surrounds a {@link #SELECT} clause.
*/
INSERT_SELECT,
/**
* The ON DUPLICATE KEY UPDATE
clause within an {@link #INSERT}
* statement.
*
* This clause surrounds several
* {@link #INSERT_ON_DUPLICATE_KEY_UPDATE_ASSIGNMENT} clauses.
*
* - the
ON DUPLICATE KEY UPDATE
keywords
* - several {@link #INSERT_ON_DUPLICATE_KEY_UPDATE_ASSIGNMENT} clauses
*
*/
INSERT_ON_DUPLICATE_KEY_UPDATE,
/**
* The ON DUPLICATE KEY UPDATE
clause within an {@link #INSERT}
* statement.
*
* This clause surrounds two {@link #FIELD} clauses.
*/
INSERT_ON_DUPLICATE_KEY_UPDATE_ASSIGNMENT,
/**
* The RETURNING
clause within an {@link #INSERT} statement.
*
* This clause surrounds
*
* - the
RETURNING
keyword
* - several {@link #FIELD} clauses
*
*/
INSERT_RETURNING,
// -------------------------------------------------------------------------
// Clauses that are used in an UPDATE statement
// -------------------------------------------------------------------------
/**
* A complete UPDATE
statement.
*/
UPDATE,
/**
* An UPDATE
clause within an {@link #UPDATE} statement.
*
* This clause surrounds
*
* - the
UPDATE
keyword
* - the table that is being updated
*
*/
UPDATE_UPDATE,
/**
* A SET
clause within an {@link #UPDATE} statement.
*
* This clause surrounds
*
* - the
SET
keyword
* - one or several assignments: {@link #UPDATE_SET_ASSIGNMENT}
*
*/
UPDATE_SET,
/**
* An assigment within a {@link #UPDATE_SET} clause within an
* {@link #UPDATE} statement.
*
* This clause surrounds
*
* - a {@link #FIELD} receiving the assignment
* - an assigment operator
* - a {@link #FIELD} being assigned
*
*/
UPDATE_SET_ASSIGNMENT,
/**
* A vendor-specific FROM
clause within an {@link #UPDATE} statement.
*
* This clause surrounds
*
* - the
FROM
keyword
* - the table reference list
*
*
* See {@link #TABLE} and related clauses for possible table references.
*/
UPDATE_FROM,
/**
* A WHERE
clause within an {@link #UPDATE} statement.
*
* This clause surrounds
*
* - the
WHERE
keyword
* - a {@link #CONDITION}
*
*/
UPDATE_WHERE,
/**
* A RETURNING
clause within an {@link #UPDATE} statement.
*
* This clause surrounds
*
* - the
RETURNING
keyword
* - several {@link #FIELD} clauses
*
*/
UPDATE_RETURNING,
// -------------------------------------------------------------------------
// Clauses that are used in an DELETE statement
// -------------------------------------------------------------------------
/**
* A complete DELETE
statement.
*/
DELETE,
/**
* A DELETE
clause within an {@link #DELETE} statement.
*
* This clause surrounds
*
* - the
DELETE FROM
keywords
* - the table that is being deleted
*
*/
DELETE_DELETE,
/**
* A WHERE
clause within an {@link #DELETE} statement.
*
* This clause surrounds
*
* - the
WHERE
keyword
* - a {@link #CONDITION}
*
*/
DELETE_WHERE,
// -------------------------------------------------------------------------
// Clauses that are used in an MERGE statement
// -------------------------------------------------------------------------
/**
* A complete MERGE
statement.
*/
MERGE,
/**
* A MERGE INTO
clause within an {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
MERGE INTO
keywords
* - the table that is being merged
*
*/
MERGE_MERGE_INTO,
/**
* A USING
clause within a {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
USING
keyword
* - a {@link #TABLE}
*
*/
MERGE_USING,
/**
* An ON
clause within a {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
ON
keyword
* - a {@link #CONDITION}
*
*/
MERGE_ON,
/**
* A WHEN MATCHED THEN UPDATE
clause within a {@link #MERGE}
* statement.
*
* This clause surrounds
*
* - the
WHEN MATCHED THEN UPDATE
keywords
* - a {@link #MERGE_SET} clause
* - a {@link #MERGE_WHERE} clause
* - a {@link #MERGE_DELETE_WHERE} clause
*
*/
MERGE_WHEN_MATCHED_THEN_UPDATE,
/**
* A SET
clause within a
* {@link #MERGE_WHEN_MATCHED_THEN_UPDATE} clause within an {@link #MERGE}
* statement.
*
* This clause surrounds
*
* - the
SET
keyword
* - several {@link #MERGE_SET_ASSIGNMENT} clauses
*
*/
MERGE_SET,
/**
* An assigment within a {@link #MERGE_SET} clause within an {@link #MERGE}
* statement.
*
* This clause surrounds
*
* - a {@link #FIELD} receiving the assignment
* - an assigment operator
* - a {@link #FIELD} being assigned
*
*/
MERGE_SET_ASSIGNMENT,
/**
* A WHERE
clause within a
* {@link #MERGE_WHEN_MATCHED_THEN_UPDATE} clause within a
* {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
WHERE
keyword
* - a {@link #CONDITION}
*
*/
MERGE_WHERE,
/**
* A DELETE_WHERE
clause within a
* {@link #MERGE_WHEN_MATCHED_THEN_UPDATE} clause within a {@link #MERGE}
* statement.
*
* This clause surrounds
*
* - the
DELETE WHERE
keyword
* - a {@link #CONDITION}
*
*/
MERGE_DELETE_WHERE,
/**
* A WHEN NOT MATCHED THEN INSERT
clause within a
* {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
WHEN NOT MATCHED THEN INSERT
keywords
* - several {@link #FIELD} clauses
*
*/
MERGE_WHEN_NOT_MATCHED_THEN_INSERT,
/**
* A VALUES
clause within a {@link #MERGE} statement.
*
* This clause surrounds
*
* - the
VALUES
keyword
* - several {@link #FIELD_ROW} clauses
*
*/
MERGE_VALUES,
// -------------------------------------------------------------------------
// Clauses that are used in an TRUNCATE statement
// -------------------------------------------------------------------------
/**
* A complete TRUNCATE
statement.
*/
TRUNCATE,
/**
* A TRUNCATE
clause within an {@link #TRUNCATE} statement.
*
* This clause surrounds
*
* - the
TRUNCATE TABLE
keywords
* - the table that is being truncated
*
*/
TRUNCATE_TRUNCATE,
// -------------------------------------------------------------------------
// Clauses that are used in an ALTER statement
// -------------------------------------------------------------------------
/**
* A complete CREATE TABLE
statement.
*/
CREATE_TABLE,
/**
* A view name clause within a {@link #CREATE_TABLE} statement.
*
* This clause surrounds
*
* - The table name
* - The (optional) column names
*
*/
CREATE_TABLE_NAME,
/**
* An AS
clause within a {@link #CREATE_TABLE} statement.
*
* This clause surrounds
*
* - The
AS
keyword
* - The select code
*
*/
CREATE_TABLE_AS,
/**
* A column list within a {@link #CREATE_TABLE} statement.
*
* This clause surrounds
*
* - The parentheses
* - The column list
*
*/
CREATE_TABLE_COLUMNS,
/**
* A complete CREATE VIEW
statement.
*/
CREATE_VIEW,
/**
* A view name clause within a {@link #CREATE_VIEW} statement.
*
* This clause surrounds
*
* - The view name
* - The (optional) column names
*
*/
CREATE_VIEW_NAME,
/**
* An AS
clause within a {@link #CREATE_VIEW} statement.
*
* This clause surrounds
*
* - The
AS
keyword
* - The view code
*
*/
CREATE_VIEW_AS,
/**
* A complete CREATE INDEX
statement.
*/
CREATE_INDEX,
/**
* A complete CREATE SEQUENCE
statement.
*/
CREATE_SEQUENCE,
/**
* A SEQUENCE
clause within a {@link #CREATE_SEQUENCE} statement.
*
* This clause surrounds
*
* - the
CREATE SEQUENCE
keywords
* - the sequence that is being created
*
*/
CREATE_SEQUENCE_SEQUENCE,
/**
* A complete ALTER SEQUENCE
statement.
*/
ALTER_SEQUENCE,
/**
* A SEQUENCE
clause within an {@link #ALTER_SEQUENCE} statement.
*
* This clause surrounds
*
* - the
ALTER SEQUENCE
keywords
* - the sequence that is being altered
*
*/
ALTER_SEQUENCE_SEQUENCE,
/**
* A RESTART
clause within an {@link #ALTER_SEQUENCE} statement.
*
* This clause surrounds
*
* - the
RESTART
keyword
* - the
WITH
keyword and the new sequence value, if applicable.
*
*/
ALTER_SEQUENCE_RESTART,
/**
* A complete ALTER TABLE
statement.
*/
ALTER_TABLE,
/**
* A TABLE
clause within an {@link #ALTER_TABLE} statement.
*
* This clause surrounds
*
* - the
ALTER TABLE
keywords
* - the table that is being altered
*
*/
ALTER_TABLE_TABLE,
/**
* A ADD
clause within an {@link #ALTER_TABLE} statement.
*
* This clause surrounds
*
* - the
ADD
keywords
* - the column that is being added
*
*/
ALTER_TABLE_ADD,
/**
* A ALTER
clause within an {@link #ALTER_TABLE} statement.
*
* This clause surrounds
*
* - the
ALTER
keywords
* - the column that is being altered
*
*/
ALTER_TABLE_ALTER,
/**
* A ALTER DEFAULT
clause within an {@link #ALTER_TABLE}
* statement.
*
* This clause surrounds
*
* - the default expression that is being altered
*
*/
ALTER_TABLE_ALTER_DEFAULT,
/**
* A DROP
clause within an {@link #ALTER_TABLE} statement.
*
* This clause surrounds
*
* - the
DROP
keywords
* - the column that is being dropped
*
*/
ALTER_TABLE_DROP,
/**
* A complete DROP VIEW
statement.
*/
DROP_VIEW,
/**
* A VIEW
clause within an {@link #DROP_VIEW} statement.
*
* This clause surrounds
*
* - the
DROP VIEW
keywords
* - the view that is being dropped
*
*/
DROP_VIEW_TABLE,
/**
* A complete DROP TABLE
statement.
*/
DROP_TABLE,
/**
* A TABLE
clause within an {@link #DROP_TABLE} statement.
*
* This clause surrounds
*
* - the
DROP TABLE
keywords
* - the table that is being dropped
*
*/
DROP_TABLE_TABLE,
/**
* A complete DROP INDEX
statement.
*/
DROP_INDEX,
/**
* A complete DROP SEQUENCE
statement.
*/
DROP_SEQUENCE,
/**
* A SEQUENCE
clause within a {@link #DROP_SEQUENCE} statement.
*
* This clause surrounds
*
* - the
DROP SEQUENCE
keywords
* - the sequence that is being dropped
*
*/
DROP_SEQUENCE_SEQUENCE,
// -------------------------------------------------------------------------
// Other clauses
// -------------------------------------------------------------------------
/**
* A plain SQL template clause.
*/
TEMPLATE,
/**
* A custom {@link QueryPart} clause.
*/
CUSTOM
}