Package onl.ycode.stormify
Enum Class SqlDialect
- All Implemented Interfaces:
Serializable
,Comparable<SqlDialect>
,Constable
An enumeration of SQL dialects for different databases.
This enumeration is used to determine the current SQL dialect and provide helper functions to generate SQL queries. The dialect is determined by the database product name.
If the database product name is not recognized, the dialect is set to UNKNOWN
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A query builder for various SQL dialects.Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionA failsafe dialect, mostly in case of an error.The MariaDB dialect for versions 10.3 and newer.The MariaDB dialect for versions older than 10.3.The MySQL dialect for versions 8 and newer.The MySQL dialect for versions older than 8.The Oracle dialect for versions 12 and newer.The Oracle dialect for versions older than 12.The PostgreSQL dialect.The SQL Server dialect for versions 2012 and newer.The SQL Server dialect for versions older than 2012.The SQLite dialect.The dialect that is used when the database product name cannot be determined. -
Field Summary
Modifier and TypeFieldDescriptionfinal BiFunction<String,
BigDecimal, String> A helper method to ask for order by id on different databases.A query formatter that generates SQL queries with different pagination methods.final UnaryOperator<String>
A helper method to ask for sequences on different databases. -
Method Summary
Modifier and TypeMethodDescriptionstatic SqlDialect
Returns the enum constant of this class with the specified name.static SqlDialect[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
MARIA_DB_OLD
The MariaDB dialect for versions older than 10.3. -
MARIA_DB_NEW
The MariaDB dialect for versions 10.3 and newer. -
MYSQL_OLD
The MySQL dialect for versions older than 8. -
MYSQL_NEW
The MySQL dialect for versions 8 and newer. -
ORACLE_NEW
The Oracle dialect for versions 12 and newer. -
ORACLE_OLD
The Oracle dialect for versions older than 12. -
POSTGRESQL
The PostgreSQL dialect. -
SQL_SERVER_NEW
The SQL Server dialect for versions 2012 and newer. -
SQL_SERVER_OLD
The SQL Server dialect for versions older than 2012. -
SQLITE
The SQLite dialect. -
UNKNOWN
The dialect that is used when the database product name cannot be determined. -
FAILSAFE
A failsafe dialect, mostly in case of an error.
-
-
Field Details
-
sequenceDialect
A helper method to ask for sequences on different databases. As input is the name of the sequence and as output the query to get the next value from the sequence. -
orderByIdDialect
A helper method to ask for order by id on different databases. This is used to create a query that, before any other sorting, fetches a specific entity first.The first parameter is the name of the id column, and the second is the value of the id.
The result is a string that can be used in the order by part of a query.
-
queryFormatter
A query formatter that generates SQL queries with different pagination methods.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException
- if the argument is null
-