Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 75 additions & 4 deletions src/main/java/net/sf/jsqlparser/parser/feature/Feature.java
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,13 @@ public enum Feature {
executeStatementImmediate,

executeUsing,
/**
* "PREPARE" and "DEALLOCATE" of a prepared statement are allowed
*
* @see net.sf.jsqlparser.statement.PrepareStatement
* @see net.sf.jsqlparser.statement.DeallocateStatement
*/
prepare, deallocate,
/**
* SQL "REPLACE" statement is allowed
*/
Expand All @@ -521,6 +528,12 @@ public enum Feature {
* @see Drop
*/
drop, dropTable, dropIndex, dropView, dropSchema, dropSequence, dropTableIfExists, dropIndexIfExists, dropViewIfExists, dropSchemaIfExists, dropSequenceIfExists,
/**
* Oracle "PURGE" statement is allowed
*
* @see net.sf.jsqlparser.statement.PurgeStatement
*/
purge,
/**
* PostgreSQL "REASSIGN OWNED BY ... TO ..." statement is allowed
*
Expand All @@ -540,6 +553,13 @@ public enum Feature {
* @see net.sf.jsqlparser.statement.alter.database.AlterDatabase
*/
alterDatabase,
/**
* "ALTER SESSION" and "ALTER SYSTEM" statements are allowed
*
* @see net.sf.jsqlparser.statement.alter.AlterSession
* @see net.sf.jsqlparser.statement.alter.AlterSystemStatement
*/
alterSession, alterSystem,
/**
* SQL "CREATE SCHEMA" statement is allowed
*
Expand Down Expand Up @@ -628,6 +648,11 @@ public enum Feature {
* Structured type, domain and extension statements.
*/
createType, alterType, createDomain, alterDomain, createExtension, alterExtension,
/**
* PostgreSQL "CREATE POLICY", "ALTER POLICY", "CREATE STATISTICS" and "ALTER STATISTICS"
* statements are allowed
*/
createPolicy, alterPolicy, createStatistics, alterStatistics,
/**
* SQL "CREATE SYNONYM" statement is allowed
*
Expand All @@ -638,6 +663,13 @@ public enum Feature {
* SQL "CREATE TRIGGER" statement is allowed
*/
createTrigger,
/**
* MySQL/MariaDB "CREATE EVENT" and "ALTER EVENT" statements are allowed
*
* @see net.sf.jsqlparser.statement.create.event.CreateEvent
* @see net.sf.jsqlparser.statement.create.event.AlterEvent
*/
createEvent, alterEvent,
/**
* PostgreSQL "CREATE EVENT TRIGGER" and "ALTER EVENT TRIGGER" statements are allowed
*
Expand All @@ -664,8 +696,12 @@ public enum Feature {
* @see Commit
*/
commit,
/** SQL "ROLLBACK" statement is allowed */
rollback,
/** START TRANSACTION and dialect-specific BEGIN transaction statements. */
startTransaction,
/** SAVEPOINT statements. */
savepoint,
/** RELEASE [SAVEPOINT] statements. */
releaseSavepoint,
/** Explicit AND [NO] CHAIN transaction completion. */
Expand All @@ -676,6 +712,12 @@ public enum Feature {
transactionDeferrable,
/** MySQL WITH CONSISTENT SNAPSHOT transaction characteristic. */
transactionConsistentSnapshot,
/**
* SQL "LOCK TABLE" statement is allowed
*
* @see net.sf.jsqlparser.statement.lock.LockStatement
*/
lock,
/**
* SQL "COMMENT ON" statement is allowed
*
Expand Down Expand Up @@ -784,16 +826,17 @@ public enum Feature {
*/
grant, revoke, createRole, alterRole, alterDefaultPrivileges,
/**
* MySQL/MariaDB account management: "ALTER USER", "RENAME USER", "SET ROLE", "SET DEFAULT ROLE"
* and "SET PASSWORD"
* MySQL/MariaDB account management: "CREATE USER", "ALTER USER", "RENAME USER", "SET ROLE",
* "SET DEFAULT ROLE" and "SET PASSWORD"
*
* @see net.sf.jsqlparser.statement.create.user.CreateUser
* @see net.sf.jsqlparser.statement.alter.AlterUser
* @see net.sf.jsqlparser.statement.alter.RenameUser
* @see net.sf.jsqlparser.statement.SetRoleStatement
* @see net.sf.jsqlparser.statement.SetDefaultRoleStatement
* @see net.sf.jsqlparser.statement.SetPasswordStatement
*/
alterUser, renameUser, setRole, setDefaultRole, setPassword,
createUser, alterUser, renameUser, setRole, setDefaultRole, setPassword,
/**
* @see Function
*/
Expand Down Expand Up @@ -1041,10 +1084,38 @@ public enum Feature {
imprt,

/**
* "EXPORT"
* "EXPORT" and BigQuery "EXPORT DATA"
*/
export,

/**
* PostgreSQL and DuckDB "COPY" and BigQuery "LOAD DATA" statements are allowed
*
* @see net.sf.jsqlparser.statement.CopyStatement
* @see net.sf.jsqlparser.statement.load.LoadDataStatement
*/
copy, loadData,

/**
* DuckDB "ATTACH", "DETACH", "CONNECT", "DISCONNECT", "PRAGMA", "INSTALL", "LOAD", "CREATE
* MACRO" and "CREATE EXTENSION REPOSITORY" statements are allowed
*/
attach, detach, connect, disconnect, pragma, installExtension, loadExtension, createMacro, createExtensionRepository,

/**
* BigQuery "ASSERT" statement is allowed
*
* @see net.sf.jsqlparser.statement.AssertStatement
*/
assertStatement,

/**
* "SESSION" statement is allowed
*
* @see net.sf.jsqlparser.statement.SessionStatement
*/
session,

/**
* MySQL allows a ',' as a separator between key and value entries. We allow that by default,
* but it can be disabled here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public class FeaturesAllowed implements FeatureSetValidation, ModifyableFeatureS
Feature.createTableCreateOptionStrings, Feature.createTableTableOptionStrings,
Feature.createTableIfNotExists, Feature.createTableRowMovement,
Feature.createTableFromSelect,
Feature.createTrigger, Feature.createEventTrigger,
Feature.createTrigger, Feature.createEventTrigger, Feature.createEvent,
Feature.createPolicy, Feature.createStatistics,
Feature.createView).unmodifyable();
/**
* all "ALTER" {@link Feature}'s
Expand All @@ -122,7 +123,8 @@ public class FeaturesAllowed implements FeatureSetValidation, ModifyableFeatureS
Feature.alterTextSearchConfiguration,
Feature.alterCollation,
Feature.alterTablespace,
Feature.alterEventTrigger,
Feature.alterEventTrigger, Feature.alterEvent,
Feature.alterPolicy, Feature.alterStatistics,
Feature.alterView, Feature.alterIndex, Feature.alterSchema,
Feature.alterForeignDataWrapper, Feature.alterServer, Feature.alterUserMapping)
.unmodifyable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,13 @@
*/
public enum H2Version implements Version {
V_1_4_200("1.4.200",
EnumSet.of(
// supported if used with jdbc
EnumSet.of(// supported if used with jdbc
Feature.jdbcParameter,
Feature.jdbcNamedParameter,
// expressions
Feature.exprLike,
// http://h2database.com/html/commands.html#select
Feature.jdbcNamedParameter, // expressions
Feature.exprLike, // http://h2database.com/html/commands.html#select
Feature.select,
Feature.selectGroupBy, Feature.function,
Feature.selectHaving,
// https://h2database.com/html/grammar.html?#table_expression
Feature.selectHaving, // https://h2database.com/html/grammar.html?#table_expression
// https://h2database.com/html/grammar.html?#join_specification
Feature.join,
Feature.joinSimple,
Expand Down Expand Up @@ -71,73 +67,54 @@ public enum H2Version implements Version {
Feature.setOperationMinus,

// http://h2database.com/html/commands.html#create_sequence
Feature.createSequence,
// http://h2database.com/html/commands.html#alter_sequence
Feature.alterSequence,
// http://h2database.com/html/commands.html#create_schema
Feature.createSchema,
// http://h2database.com/html/commands.html#create_index
Feature.createIndex,
// http://h2database.com/html/commands.html#create_table
Feature.createSequence, // http://h2database.com/html/commands.html#alter_sequence
Feature.alterSequence, // http://h2database.com/html/commands.html#create_schema
Feature.createSchema, // http://h2database.com/html/commands.html#create_index
Feature.createIndex, // http://h2database.com/html/commands.html#create_table
Feature.createTable, Feature.createTableCreateOptionStrings,
Feature.createTableTableOptionStrings, Feature.createTableFromSelect,
Feature.createTableIfNotExists,
// http://h2database.com/html/commands.html#create_view
Feature.createTableIfNotExists, // http://h2database.com/html/commands.html#create_view
Feature.createView,
Feature.createViewForce, Feature.createOrReplaceView,
// http://h2database.com/html/commands.html#alter_view_rename
Feature.createViewForce, Feature.createOrReplaceView, // http://h2database.com/html/commands.html#alter_view_rename
// Feature.alterView,

// http://h2database.com/html/commands.html#select
Feature.top,
// http://www.h2database.com/html/advanced.html?search=limit#result_sets
Feature.top, // http://www.h2database.com/html/advanced.html?search=limit#result_sets
Feature.fetch, Feature.fetchFirst,

// http://www.h2database.com/html/commands.html?highlight=DISTINCT&search=SELECT#firstFound
Feature.distinct,
// http://www.h2database.com/html/commands.html?highlight=DISTINCT%20ON&search=SELECT#firstFound
Feature.distinctOn,
// http://h2database.com/html/commands.html#insert
Feature.distinct, // http://www.h2database.com/html/commands.html?highlight=DISTINCT%20ON&search=SELECT#firstFound
Feature.distinctOn, // http://h2database.com/html/commands.html#insert
Feature.insert,
Feature.insertValues,
Feature.values,
Feature.insertFromSelect,
// http://h2database.com/html/commands.html#update
Feature.update,
// http://h2database.com/html/commands.html#delete
Feature.delete,
// http://h2database.com/html/commands.html#truncate_table
Feature.insertFromSelect, // http://h2database.com/html/commands.html#update
Feature.update, // http://h2database.com/html/commands.html#delete
Feature.delete, // http://h2database.com/html/commands.html#truncate_table
Feature.truncate,

// http://www.h2database.com/html/commands.html#execute_immediate
Feature.executeStatementImmediate,

// http://h2database.com/html/commands.html#drop_table
// http://h2database.com/html/commands.html#drop_index
Feature.drop,
// http://h2database.com/html/commands.html#drop_table
Feature.dropTable,
// http://h2database.com/html/commands.html#drop_index
Feature.dropIndex,
// http://h2database.com/html/commands.html#drop_view
Feature.dropView,
// http://h2database.com/html/commands.html#drop_schema
Feature.dropSchema,
// http://h2database.com/html/commands.html#drop_sequence
Feature.drop, // http://h2database.com/html/commands.html#drop_table
Feature.dropTable, // http://h2database.com/html/commands.html#drop_index
Feature.dropIndex, // http://h2database.com/html/commands.html#drop_view
Feature.dropView, // http://h2database.com/html/commands.html#drop_schema
Feature.dropSchema, // http://h2database.com/html/commands.html#drop_sequence
Feature.dropSequence,
Feature.dropTableIfExists, Feature.dropIndexIfExists, Feature.dropViewIfExists,
Feature.dropSchemaIfExists, Feature.dropSequenceIfExists,
// http://h2database.com/html/commands.html#alter_table_add
Feature.dropSchemaIfExists, Feature.dropSequenceIfExists, // http://h2database.com/html/commands.html#alter_table_add
// http://h2database.com/html/commands.html#alter_table_add_constraint
// ...
Feature.alterTable,
// http://www.h2database.com/html/commands.html#explain
Feature.explain,
// http://www.h2database.com/html/commands.html#grant_right
Feature.alterTable, // http://www.h2database.com/html/commands.html#explain
Feature.explain, // http://www.h2database.com/html/commands.html#grant_right
// http://www.h2database.com/html/commands.html#grant_role
Feature.grant,
// http://h2database.com/html/commands.html#commit
Feature.commit));
Feature.grant, // http://h2database.com/html/commands.html#commit
// http://h2database.com/html/commands.html#rollback
// http://h2database.com/html/commands.html#savepoint
Feature.commit, Feature.rollback, Feature.savepoint));

private Set<Feature> features;
private String versionString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,16 @@ public enum MariaDbVersion implements Version {
Feature.tableMaintenance,

// https://mariadb.com/kb/en/account-management-sql-statements/
Feature.createRole, Feature.alterUser, Feature.renameUser, Feature.setRole,
Feature.createRole, Feature.createUser, Feature.alterUser, Feature.renameUser,
Feature.setRole,
Feature.setDefaultRole, Feature.setPassword,

// https://mariadb.com/kb/en/call/
Feature.execute, Feature.executeCall,

// https://mariadb.com/kb/en/deallocate-drop-prepare/
Feature.deallocate,

// https://mariadb.com/kb/en/drop/
Feature.drop, // https://mariadb.com/kb/en/drop-index/
Feature.dropIndex, // https://mariadb.com/kb/en/drop-table/
Expand Down Expand Up @@ -121,6 +125,10 @@ public enum MariaDbVersion implements Version {
Feature.createSchema, // https://mariadb.com/kb/en/create-trigger/
Feature.createTrigger,

// https://mariadb.com/kb/en/create-event/
// https://mariadb.com/kb/en/alter-event/
Feature.createEvent, Feature.alterEvent,

// https://mariadb.com/kb/en/create-database/
// https://mariadb.com/kb/en/alter-database/
Feature.createDatabase, Feature.alterDatabase,
Expand All @@ -141,7 +149,9 @@ public enum MariaDbVersion implements Version {
Feature.use, // https://mariadb.com/kb/en/grant/
Feature.grant, // https://mariadb.com/kb/en/revoke/
Feature.revoke, // https://mariadb.com/kb/en/commit/
Feature.commit, // https://mariadb.com/kb/en/optimizer-hints/
Feature.commit, // https://mariadb.com/kb/en/rollback/
Feature.rollback, // https://mariadb.com/kb/en/savepoint/
Feature.savepoint, // https://mariadb.com/kb/en/optimizer-hints/
Feature.mySqlHintStraightJoin,
Feature.mysqlSelectModifiers, Feature.mysqlCalcFoundRows,
Feature.mysqlSqlCacheFlag)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,16 @@ public enum MySqlVersion implements Version {
Feature.tableMaintenance,

// https://dev.mysql.com/doc/refman/8.0/en/account-management-statements.html
Feature.createRole, Feature.alterUser, Feature.renameUser, Feature.setRole,
Feature.createRole, Feature.createUser, Feature.alterUser, Feature.renameUser,
Feature.setRole,
Feature.setDefaultRole, Feature.setPassword,

// https://dev.mysql.com/doc/refman/8.0/en/call.html
Feature.execute, Feature.executeCall,

// https://dev.mysql.com/doc/refman/8.0/en/deallocate-prepare.html
Feature.deallocate,

Feature.drop, // https://dev.mysql.com/doc/refman/8.0/en/drop-table.html
Feature.dropTable, // https://dev.mysql.com/doc/refman/8.0/en/drop-index.html
Feature.dropIndex, // https://dev.mysql.com/doc/refman/8.0/en/drop-view.html
Expand Down Expand Up @@ -121,6 +125,10 @@ public enum MySqlVersion implements Version {
Feature.createIndex, // https://dev.mysql.com/doc/refman/8.0/en/create-trigger.html
Feature.createTrigger,

// https://dev.mysql.com/doc/refman/8.0/en/create-event.html
// https://dev.mysql.com/doc/refman/8.0/en/alter-event.html
Feature.createEvent, Feature.alterEvent,

// https://dev.mysql.com/doc/refman/8.0/en/describe.html
Feature.describe,
Feature.desc, // https://dev.mysql.com/doc/refman/8.0/en/explain.html
Expand All @@ -134,7 +142,8 @@ public enum MySqlVersion implements Version {
Feature.grant, // https://dev.mysql.com/doc/refman/8.0/en/revoke.html
Feature.revoke, // https://dev.mysql.com/doc/refman/8.0/en/use.html
Feature.use, // https://dev.mysql.com/doc/refman/8.0/en/commit.html
Feature.commit, Feature.startTransaction, Feature.releaseSavepoint,
Feature.commit, Feature.rollback, Feature.startTransaction,
Feature.savepoint, Feature.releaseSavepoint,
Feature.transactionChain, Feature.transactionConsistentSnapshot, //
Feature.mySqlHintStraightJoin,
Feature.mysqlSqlCacheFlag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,17 @@ public enum OracleVersion implements Version {
Feature.createTrigger, // https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/CREATE-SCHEMA.html
Feature.createSchema,

Feature.commit,
Feature.commit, Feature.rollback, Feature.savepoint,

// https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/LOCK-TABLE.html
Feature.lock,

// https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-SESSION.html
// https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/ALTER-SYSTEM.html
Feature.alterSession, Feature.alterSystem,

// https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/PURGE.html
Feature.purge,

// https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/COMMENT.html
Feature.comment, Feature.commentOnTable, Feature.commentOnColumn,
Expand Down
Loading
Loading