Enum Dialect
- All Implemented Interfaces:
Serializable
,Comparable<Dialect>
,java.lang.constant.Constable
The SQL dialect used by a connection. This class defines also a few driver-specific operations
that cannot (to our knowledge) be inferred from the
DatabaseMetaData
.- Since:
- 0.7
- Version:
- 1.1
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
The protocol in JDBC URL, ornull
if unknown.final boolean
Whether this dialect support adding table constraints after creation.final boolean
true
if child tables inherit the index of their parent tables.final boolean
Whether this dialect support table inheritance. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Dialect
guess
(DatabaseMetaData metadata) Returns the presumed SQL dialect.static Dialect
Returns the enum constant of this type with the specified name.static Dialect[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
ANSI
The database is presumed to use ANSI SQL syntax.- See Also:
-
DERBY
The database uses Derby syntax. This is ANSI, with some constraints that PostgreSQL does not have (for example column withUNIQUE
constraint must explicitly be specified asNOT NULL
). -
HSQL
The database uses HSQL syntax. This is ANSI, but does not allowINSERT
statements inserting many lines. It also have aSHUTDOWN
command which is specific to HSQLDB. -
POSTGRESQL
The database uses PostgreSQL syntax. This is ANSI, but provided an a separated enumeration value because it allows a few additional commands likeVACUUM
. -
ORACLE
The database uses Oracle syntax. This is ANSI, but without"AS"
keyword. -
SQLITE
The database uses SQLite syntax. This is ANSI, but with several limitations.- See Also:
-
-
Field Details
-
protocol
The protocol in JDBC URL, ornull
if unknown. This is the part after"jdbc:"
and before the next':'
. -
supportsTableInheritance
public final boolean supportsTableInheritanceWhether this dialect support table inheritance. -
supportsIndexInheritance
public final boolean supportsIndexInheritancetrue
if child tables inherit the index of their parent tables. This feature is not yet supported in PostgreSQL.- See Also:
-
supportsAlterTableWithAddConstraint
public final boolean supportsAlterTableWithAddConstraintWhether this dialect support adding table constraints after creation. This feature is not yet supported in SQLite.- See Also:
-
-
Constructor Details
-
Dialect
private Dialect(String protocol, boolean supportsTableInheritance, boolean supportsAlterTableWithAddConstraint) Creates a new enumeration value for a SQL dialect for the given protocol.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
guess
Returns the presumed SQL dialect. If this method cannot guess the dialect, thanANSI
is presumed.- Parameters:
metadata
- the database metadata.- Returns:
- the presumed SQL dialect (never
null
). - Throws:
SQLException
- if an error occurred while querying the metadata.
-