public interface SQLDialect extends Serializable
Modifier and Type | Interface and Description |
---|---|
static interface |
SQLDialect.LimitHandler
Handler to apply limit/offset to SQL query.
|
Modifier and Type | Method and Description |
---|---|
static SQLDialect |
db2()
Get the
SQLDialect for the DB2 database platform. |
default boolean |
deleteStatementAliasSupported()
Get whether alias is supported in the DELETE clause.
|
default boolean |
deleteStatementTargetRequired()
Get whether the DELETE clause target must be specified.
|
static SQLDialect |
derby()
Get the
SQLDialect for the Derby database platform. |
static Optional<SQLDialect> |
detect(com.holonplatform.jdbc.DatabasePlatform database)
Detect a suitable
SQLDialect to use with given database platform, if available. |
boolean |
generatedKeyAlwaysReturned()
Retrieves whether a generated key will always be returned if the column name(s) or index(es) specified for the
auto generated key column(s) are valid and the statement succeeds.
|
default String |
getColumnName(String columnName)
Get the actual column name for given column name (for example, applying case transformations)
|
default Optional<Class<?>> |
getJavaType(SQLType sqlType)
Get the Java type which corresponds to given SQL type for this dialect.
|
default Optional<SQLDialect.LimitHandler> |
getLimitHandler()
Get the
SQLDialect.LimitHandler |
default Optional<String> |
getLockClause(com.holonplatform.core.query.lock.LockMode mode,
long timeout)
Get the SQL lock clause for given lock condition.
|
default Optional<String> |
getLockHint(com.holonplatform.core.query.lock.LockMode mode,
long timeout)
Get the SQL lock hint to append to the FROM clause for given lock condition.
|
default Optional<SQLType> |
getSqlType(Class<?> javaType)
Get the SQL type which corresponds to given Java type for this dialect.
|
default String |
getTableName(String tableName)
Get the actual table name for given table name (for example, applying case transformations)
|
static SQLDialect |
h2()
Get the
SQLDialect for the H2 database platform. |
static SQLDialect |
HANA()
Get the
SQLDialect for the SAP HANA database platform. |
static SQLDialect |
hsqldb()
Get the
SQLDialect for the HSQLDB database platform. |
static SQLDialect |
informix()
Get the
SQLDialect for the Informix database platform. |
void |
init(SQLDialectContext context)
Dialect initialization hook at parent datastore initialization.
|
static SQLDialect |
mariaDB()
Get the
SQLDialect for the MariaDB database platform. |
static SQLDialect |
mySQL()
Get the
SQLDialect for the MySQL database platform. |
static SQLDialect |
oracle()
Get the
SQLDialect for the Oracle database platform. |
static SQLDialect |
postgreSQL()
Get the
SQLDialect for the PostgreSQL database platform. |
default Optional<SQLFunction> |
resolveFunction(com.holonplatform.core.query.QueryFunction<?,?> function)
Resolve given
function into a dialect-specific SQLFunction . |
static SQLDialect |
sqlite()
Get the
SQLDialect for the SQLite database platform. |
static SQLDialect |
sqlServer()
Get the
SQLDialect for the SQL Server database platform. |
default boolean |
supportGetGeneratedKeyByName()
Retrieves whether auto-generated keys can be retrieved by name after a statement has been executed.
|
default boolean |
supportsBinaryStreamParameter()
Get whether binary stream type parameters are supported.
|
boolean |
supportsGetGeneratedKeys()
Retrieves whether auto-generated keys can be retrieved after a statement has been executed.
|
boolean |
supportsLikeEscapeClause()
Retrieves whether this database supports specifying a
LIKE escape clause. |
default boolean |
supportsSqlType(int sqlType)
Get whether given SQL type is supported by this dialect.
|
default com.holonplatform.core.exceptions.DataAccessException |
translateException(SQLException exception)
Translates given
SQLException into a suitable DataAccessException . |
default boolean |
updateStatementAliasSupported()
Get whether alias is supported in the UPDATE clause.
|
default boolean |
updateStatementFromSupported()
Get whether a FROM clause is supported in the UPDATE clause.
|
default boolean |
updateStatementSetAliasSupported()
Get whether alias is supported in the SET clause of an UPDATE clause.
|
default boolean |
useOuterInJoins()
Get whether to use the
OUTER keyword in join serialization. |
void init(SQLDialectContext context) throws SQLException
context
- Dialect contextSQLException
- An error occurred during dialect initializationdefault Optional<SQLFunction> resolveFunction(com.holonplatform.core.query.QueryFunction<?,?> function)
function
into a dialect-specific SQLFunction
.function
- The function to resolve (not null)default boolean useOuterInJoins()
OUTER
keyword in join serialization.true
to use the OUTER
keyword in join serializationdefault boolean updateStatementAliasSupported()
true
if alias is supported in the UPDATE clausedefault boolean updateStatementFromSupported()
true
if a FROM clause is supported in the UPDATE clausedefault boolean updateStatementSetAliasSupported()
true
if alias is supported in the SET clause of an UPDATE clausedefault boolean deleteStatementAliasSupported()
true
if alias is supported in the DELETE clausedefault boolean deleteStatementTargetRequired()
true
if the DELETE clause target must be specifieddefault boolean supportsBinaryStreamParameter()
true
if binary stream type parameters are supporteddefault String getTableName(String tableName)
tableName
- Table namedefault String getColumnName(String columnName)
columnName
- Column namedefault boolean supportsSqlType(int sqlType)
sqlType
- The SQL type idtrue
if type is supported, false
otherwiseTypes
default Optional<Class<?>> getJavaType(SQLType sqlType)
sqlType
- The sql type (not null)default Optional<SQLType> getSqlType(Class<?> javaType)
javaType
- The sql type (not null)boolean supportsLikeEscapeClause()
LIKE
escape clause.true
if so; false
otherwiseboolean supportsGetGeneratedKeys()
true
if auto-generated keys can be retrieved after a statement has executed;
false
otherwiseboolean generatedKeyAlwaysReturned()
true
if so; false
otherwisedefault boolean supportGetGeneratedKeyByName()
true
if auto-generated keys can be retrieved by name after a statement has executeddefault Optional<String> getLockClause(com.holonplatform.core.query.lock.LockMode mode, long timeout)
mode
- Lock modetimeout
- Lock timeout in millisecondsdefault Optional<String> getLockHint(com.holonplatform.core.query.lock.LockMode mode, long timeout)
mode
- Lock modetimeout
- Lock timeout in millisecondsdefault com.holonplatform.core.exceptions.DataAccessException translateException(SQLException exception)
SQLException
into a suitable DataAccessException
.exception
- Exception to translate (not null)DataAccessException
default Optional<SQLDialect.LimitHandler> getLimitHandler()
SQLDialect.LimitHandler
static Optional<SQLDialect> detect(com.holonplatform.jdbc.DatabasePlatform database)
SQLDialect
to use with given database platform, if available.database
- Database platformSQLDialect
for given database platformstatic SQLDialect h2()
SQLDialect
for the H2 database platform.static SQLDialect derby()
SQLDialect
for the Derby database platform.static SQLDialect hsqldb()
SQLDialect
for the HSQLDB database platform.static SQLDialect mySQL()
SQLDialect
for the MySQL database platform.static SQLDialect mariaDB()
SQLDialect
for the MariaDB database platform.static SQLDialect postgreSQL()
SQLDialect
for the PostgreSQL database platform.static SQLDialect oracle()
SQLDialect
for the Oracle database platform.static SQLDialect sqlServer()
SQLDialect
for the SQL Server database platform.static SQLDialect db2()
SQLDialect
for the DB2 database platform.static SQLDialect informix()
SQLDialect
for the Informix database platform.static SQLDialect HANA()
SQLDialect
for the SAP HANA database platform.static SQLDialect sqlite()
SQLDialect
for the SQLite database platform.Copyright © 2019 The Holon Platform. All rights reserved.