Package org.h2.engine
Class Mode
- java.lang.Object
-
- org.h2.engine.Mode
-
public class Mode extends java.lang.ObjectThe compatibility modes. There is a fixed set of modes (for example PostgreSQL, MySQL). Each mode has different settings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMode.CharPaddingWhen CHAR values are right-padded with spaces.static classMode.ExpressionNamesGeneration of column names for expressions.static classMode.ModeEnumstatic classMode.UniqueIndexNullsHandlingDetermines how rows withNULLvalues in indexed columns are handled in unique indexes.static classMode.ViewExpressionNamesGeneration of column names for expressions to be used in a view.
-
Field Summary
Fields Modifier and Type Field Description booleanaliasColumnNameWhen enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in getTableName().booleanallNumericTypesHavePrecisionIftrueall numeric data types may have precision and 'UNSIGNED' clause.booleanallowDB2TimestampFormatWhether DB2 TIMESTAMP formats are allowed.booleanallowEmptyInPredicateWhether IN predicate may have an empty value list.booleanallowEmptySchemaValuesAsDefaultSchemaIftrueconstructs like 'CREATE TABLE CATALOG..TABLE_NAME' are allowed, the default schema is used.booleanallowPlusForStringConcatText can be concatenated using '+'.booleanallowUnrelatedOrderByExpressionsInDistinctQueriesIftrueunrelated ORDER BY expression are allowed in DISTINCT queries, iffalsethey are disallowed.booleanallowUsingFromClauseInUpdateStatementIftrue, allow using from clause in update statement.booleanalterTableExtensionsMySQLIftruesome additional non-standard ALTER TABLE commands are allowed.booleanalterTableModifyColumnIftruenon-standard ALTER TABLE MODIFY COLUMN is allowed.booleanautoIncrementClauseWhether MySQL-style AUTO_INCREMENT clause is supported.booleancharAndByteLengthUnitsIftrue'CHAR' and 'BYTE' length units are allowed.Mode.CharPaddingcharPaddingHow to pad or trim CHAR values.booleanconvertOnlyToSmallerScaleWhen converting the scale of decimal data, the number is only converted if the new scale is smaller than the current scale.booleancreateUniqueConstraintForReferencedColumnsIftrue, referential constraints will create a unique constraint on referenced columns if it doesn't exist instead of throwing an exception.booleandateTimeValueWithinTransactionIftrue, datetime value function return the same value within a transaction, iffalsedatetime value functions return the same value within a command.booleandecimalSequencesIftrueNEXT VALUE FOR SEQUENCE, CURRENT VALUE FOR SEQUENCE, SEQUENCE.NEXTVAL, and SEQUENCE.CURRVAL return values with DECIMAL/NUMERIC data type instead of BIGINT.java.util.Set<java.lang.String>disallowedTypesAn optional Set of hidden/disallowed column types.booleandiscardWithTableHintsDiscard SQLServer table hints (e.g.Mode.ExpressionNamesexpressionNamesHow column names are generated for expressions.booleanforBitDataIftrue'FOR BIT DATA' clauses are allowed for character string data types.booleangroupByColumnIndexAllow to use GROUP BY n, where n is column index in the SELECT list, similar to ORDER BYbooleanidentityClauseWhether SQL Server-style IDENTITY clause is supported.booleanidentityColumnsHaveDefaultOnNullIftrue, identity columns have DEFAULT ON NULL clause.booleanidentityDataTypeWhether IDENTITY pseudo data type is supported.booleanindexDefinitionInCreateTableCreating indexes in the CREATE TABLE statement is allowed usingINDEX(..)orKEY(..).booleaninsertOnConflictPostgreSQL style INSERT ...booleanisolationLevelInSelectOrInsertStatementcan set the isolation level using WITH {RR|RS|CS|UR}booleanlimitWhether LIMIT / OFFSET clauses are supported.booleanlogIsLogBase10The single-argument function LOG() uses base 10 instead of E.booleanmergeWhereIftrue, merge when matched clause may have WHERE clause.booleanminusIsExceptWhether MINUS can be used as EXCEPT.private Mode.ModeEnummodeEnumprivate static java.util.HashMap<java.lang.String,Mode>MODESprivate java.lang.StringnamebooleannextvalAndCurrvalPseudoColumnsIftrue, sequence.NEXTVAL and sequence.CURRVAL pseudo columns are supported.booleannextValueReturnsDifferentValuesIftrue, the next value expression returns different values when invoked multiple times within a row.booleannumericWithBooleanComparisonAllow to compare numeric with BOOLEAN.booleanonDuplicateKeyUpdateMySQL style INSERT ...booleanregexpReplaceBackslashReferencesThe function REGEXP_REPLACE() uses \ for back-references.booleanreplaceIntoMySQL style REPLACE INTO.booleanserialDataTypesWhether SERIAL and BIGSERIAL pseudo data types are supported.booleansquareBracketQuotedNamesIdentifiers may be quoted using square brackets as in [Test].java.util.regex.PatternsupportedClientInfoPropertiesRegExPattern describing the keys the java.sql.Connection.setClientInfo() method accepts.booleansupportPoundSymbolForColumnNamesSupport the # for column namesbooleanswapConvertFunctionParametersSwap the parameters of the CONVERT function.booleanswapLogFunctionParametersSwap the parameters of LOG() function.booleansysDummy1Support the pseudo-table SYSIBM.SYSDUMMY1.booleansystemColumnsThe system columns 'ctid' and 'oid' are supported.booleantakeGeneratedSequenceValueIftrue, last identity of the session is updated on generation of a new sequence value.booleantakeInsertedIdentityIftrue, last identity of the session is updated on insertion of a new value into identity column.booleantopInDMLWhether TOP clause in DML commands is supported.booleantopInSelectWhether TOP clause in SELECT queries is supported.booleantreatEmptyStringsAsNullEmpty strings are treated like NULL values.booleantruncateTableRestartIdentityIftrueTRUNCATE TABLE uses RESTART IDENTITY by default.java.util.HashMap<java.lang.String,DataType>typeByNameMapCustom mappings from type names to data types.Mode.UniqueIndexNullsHandlinguniqueIndexNullsHandlingDetermines how rows withNULLvalues in indexed columns are handled in unique indexes.booleanupdateSequenceOnManualIdentityInsertionIftrue, sequences of generated by default identity columns are updated when value is provided by user.Mode.ViewExpressionNamesviewExpressionNamesHow column names are generated for views.booleanzeroExLiteralsAreBinaryStringsIftrue0x-prefixed numbers are parsed as binary string literals, iffalsethey are parsed as hexadecimal numeric values.
-
Constructor Summary
Constructors Modifier Constructor Description privateMode(Mode.ModeEnum modeEnum)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidadd(Mode mode)Mode.ModeEnumgetEnum()static ModegetInstance(java.lang.String name)Get the mode with the given name.java.lang.StringgetName()static ModegetRegular()java.lang.StringtoString()
-
-
-
Field Detail
-
MODES
private static final java.util.HashMap<java.lang.String,Mode> MODES
-
aliasColumnName
public boolean aliasColumnName
When enabled, aliased columns (as in SELECT ID AS I FROM TEST) return the alias (I in this case) in ResultSetMetaData.getColumnName() and 'null' in getTableName(). If disabled, the real column name (ID in this case) and table name is returned.
-
convertOnlyToSmallerScale
public boolean convertOnlyToSmallerScale
When converting the scale of decimal data, the number is only converted if the new scale is smaller than the current scale. Usually, the scale is converted and 0s are added if required.
-
indexDefinitionInCreateTable
public boolean indexDefinitionInCreateTable
Creating indexes in the CREATE TABLE statement is allowed usingINDEX(..)orKEY(..). Example:create table test(id int primary key, name varchar(255), key idx_name(name));
-
squareBracketQuotedNames
public boolean squareBracketQuotedNames
Identifiers may be quoted using square brackets as in [Test].
-
systemColumns
public boolean systemColumns
The system columns 'ctid' and 'oid' are supported.
-
uniqueIndexNullsHandling
public Mode.UniqueIndexNullsHandling uniqueIndexNullsHandling
Determines how rows withNULLvalues in indexed columns are handled in unique indexes.
-
treatEmptyStringsAsNull
public boolean treatEmptyStringsAsNull
Empty strings are treated like NULL values. Useful for Oracle emulation.
-
sysDummy1
public boolean sysDummy1
Support the pseudo-table SYSIBM.SYSDUMMY1.
-
allowPlusForStringConcat
public boolean allowPlusForStringConcat
Text can be concatenated using '+'.
-
logIsLogBase10
public boolean logIsLogBase10
The single-argument function LOG() uses base 10 instead of E.
-
swapLogFunctionParameters
public boolean swapLogFunctionParameters
Swap the parameters of LOG() function.
-
regexpReplaceBackslashReferences
public boolean regexpReplaceBackslashReferences
The function REGEXP_REPLACE() uses \ for back-references.
-
swapConvertFunctionParameters
public boolean swapConvertFunctionParameters
Swap the parameters of the CONVERT function.
-
isolationLevelInSelectOrInsertStatement
public boolean isolationLevelInSelectOrInsertStatement
can set the isolation level using WITH {RR|RS|CS|UR}
-
onDuplicateKeyUpdate
public boolean onDuplicateKeyUpdate
MySQL style INSERT ... ON DUPLICATE KEY UPDATE ... and INSERT IGNORE.
-
replaceInto
public boolean replaceInto
MySQL style REPLACE INTO.
-
insertOnConflict
public boolean insertOnConflict
PostgreSQL style INSERT ... ON CONFLICT DO NOTHING.
-
supportedClientInfoPropertiesRegEx
public java.util.regex.Pattern supportedClientInfoPropertiesRegEx
Pattern describing the keys the java.sql.Connection.setClientInfo() method accepts.
-
supportPoundSymbolForColumnNames
public boolean supportPoundSymbolForColumnNames
Support the # for column names
-
allowEmptyInPredicate
public boolean allowEmptyInPredicate
Whether IN predicate may have an empty value list.
-
charPadding
public Mode.CharPadding charPadding
How to pad or trim CHAR values.
-
allowDB2TimestampFormat
public boolean allowDB2TimestampFormat
Whether DB2 TIMESTAMP formats are allowed.
-
discardWithTableHints
public boolean discardWithTableHints
Discard SQLServer table hints (e.g. "SELECT * FROM table WITH (NOLOCK)")
-
dateTimeValueWithinTransaction
public boolean dateTimeValueWithinTransaction
Iftrue, datetime value function return the same value within a transaction, iffalsedatetime value functions return the same value within a command.
-
zeroExLiteralsAreBinaryStrings
public boolean zeroExLiteralsAreBinaryStrings
Iftrue0x-prefixed numbers are parsed as binary string literals, iffalsethey are parsed as hexadecimal numeric values.
-
allowUnrelatedOrderByExpressionsInDistinctQueries
public boolean allowUnrelatedOrderByExpressionsInDistinctQueries
Iftrueunrelated ORDER BY expression are allowed in DISTINCT queries, iffalsethey are disallowed.
-
alterTableExtensionsMySQL
public boolean alterTableExtensionsMySQL
Iftruesome additional non-standard ALTER TABLE commands are allowed.
-
alterTableModifyColumn
public boolean alterTableModifyColumn
Iftruenon-standard ALTER TABLE MODIFY COLUMN is allowed.
-
truncateTableRestartIdentity
public boolean truncateTableRestartIdentity
IftrueTRUNCATE TABLE uses RESTART IDENTITY by default.
-
decimalSequences
public boolean decimalSequences
IftrueNEXT VALUE FOR SEQUENCE, CURRENT VALUE FOR SEQUENCE, SEQUENCE.NEXTVAL, and SEQUENCE.CURRVAL return values with DECIMAL/NUMERIC data type instead of BIGINT.
-
allowEmptySchemaValuesAsDefaultSchema
public boolean allowEmptySchemaValuesAsDefaultSchema
Iftrueconstructs like 'CREATE TABLE CATALOG..TABLE_NAME' are allowed, the default schema is used.
-
allNumericTypesHavePrecision
public boolean allNumericTypesHavePrecision
Iftrueall numeric data types may have precision and 'UNSIGNED' clause.
-
forBitData
public boolean forBitData
Iftrue'FOR BIT DATA' clauses are allowed for character string data types.
-
charAndByteLengthUnits
public boolean charAndByteLengthUnits
Iftrue'CHAR' and 'BYTE' length units are allowed.
-
nextvalAndCurrvalPseudoColumns
public boolean nextvalAndCurrvalPseudoColumns
Iftrue, sequence.NEXTVAL and sequence.CURRVAL pseudo columns are supported.
-
nextValueReturnsDifferentValues
public boolean nextValueReturnsDifferentValues
Iftrue, the next value expression returns different values when invoked multiple times within a row. This setting does not affect NEXTVAL() function.
-
updateSequenceOnManualIdentityInsertion
public boolean updateSequenceOnManualIdentityInsertion
Iftrue, sequences of generated by default identity columns are updated when value is provided by user.
-
takeInsertedIdentity
public boolean takeInsertedIdentity
Iftrue, last identity of the session is updated on insertion of a new value into identity column.
-
takeGeneratedSequenceValue
public boolean takeGeneratedSequenceValue
Iftrue, last identity of the session is updated on generation of a new sequence value.
-
identityColumnsHaveDefaultOnNull
public boolean identityColumnsHaveDefaultOnNull
Iftrue, identity columns have DEFAULT ON NULL clause.
-
mergeWhere
public boolean mergeWhere
Iftrue, merge when matched clause may have WHERE clause.
-
allowUsingFromClauseInUpdateStatement
public boolean allowUsingFromClauseInUpdateStatement
Iftrue, allow using from clause in update statement.
-
createUniqueConstraintForReferencedColumns
public boolean createUniqueConstraintForReferencedColumns
Iftrue, referential constraints will create a unique constraint on referenced columns if it doesn't exist instead of throwing an exception.
-
expressionNames
public Mode.ExpressionNames expressionNames
How column names are generated for expressions.
-
viewExpressionNames
public Mode.ViewExpressionNames viewExpressionNames
How column names are generated for views.
-
topInSelect
public boolean topInSelect
Whether TOP clause in SELECT queries is supported.
-
topInDML
public boolean topInDML
Whether TOP clause in DML commands is supported.
-
limit
public boolean limit
Whether LIMIT / OFFSET clauses are supported.
-
minusIsExcept
public boolean minusIsExcept
Whether MINUS can be used as EXCEPT.
-
identityDataType
public boolean identityDataType
Whether IDENTITY pseudo data type is supported.
-
serialDataTypes
public boolean serialDataTypes
Whether SERIAL and BIGSERIAL pseudo data types are supported.
-
identityClause
public boolean identityClause
Whether SQL Server-style IDENTITY clause is supported.
-
autoIncrementClause
public boolean autoIncrementClause
Whether MySQL-style AUTO_INCREMENT clause is supported.
-
disallowedTypes
public java.util.Set<java.lang.String> disallowedTypes
An optional Set of hidden/disallowed column types. Certain DBMSs don't support all column types provided by H2, such as "NUMBER" when using PostgreSQL mode.
-
typeByNameMap
public java.util.HashMap<java.lang.String,DataType> typeByNameMap
Custom mappings from type names to data types.
-
groupByColumnIndex
public boolean groupByColumnIndex
Allow to use GROUP BY n, where n is column index in the SELECT list, similar to ORDER BY
-
numericWithBooleanComparison
public boolean numericWithBooleanComparison
Allow to compare numeric with BOOLEAN.
-
name
private final java.lang.String name
-
modeEnum
private final Mode.ModeEnum modeEnum
-
-
Constructor Detail
-
Mode
private Mode(Mode.ModeEnum modeEnum)
-
-
Method Detail
-
add
private static void add(Mode mode)
-
getInstance
public static Mode getInstance(java.lang.String name)
Get the mode with the given name.- Parameters:
name- the name of the mode- Returns:
- the mode object
-
getRegular
public static Mode getRegular()
-
getName
public java.lang.String getName()
-
getEnum
public Mode.ModeEnum getEnum()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-