|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DbEngine
Information about database-specific options that are not covered by the
Hibernate Dialect
objects.
EngineFactory.createEngine(Dialect)
Method Summary | |
---|---|
String |
abs(String value)
Get the function call that takes the absolute of a value. |
boolean |
analyzeAfterBatchOperation()
If TRUE, a batcher that inserts, updates or delets a lot of rows in a table should execute the SQL returned by getAnalyzeTableSql(String, String, String) for that table. |
boolean |
caseInsensitiveComparison()
If the database does case sensitive or case insensitive string comparison in expressions. |
String |
castToDate(String value)
Get a function that casts a date/timestamp to a date (eg. no time should be included in the result). |
boolean |
checkForInvalidNumberOperation()
If we need to check for invalid arguments to numerical functions to avoid exceptions from the database. |
String |
exp(String value)
Get the function call that calculates the exponential of a value. |
String |
getAnalyzeTableSql(String catalog,
String schema,
String table)
Generate SQL to update the index statistics for a table. |
String |
getCaseSensitiveVarchar(int length)
Generate a column declaration that creates a case-sensitive variable-length string column type. |
String |
getCreateIndexSql(String catalog,
String schema,
String table,
String name,
Set<String> columns,
boolean unique)
Generate SQL to create an index. |
String |
getDropIndexSql(String catalog,
String schema,
String table,
String name,
boolean unique)
Generate SQL to drop an index. |
String |
getOptimizeTableSql(String catalog,
String schema,
String table)
Generate SQL to optimize a table. |
String |
inspectSchemaGenerationSQL(String sql,
org.hibernate.dialect.Dialect dialect,
boolean update)
Let the DbEninge inspect a schema generation sql statment and possible modify it before it is sent to the database. |
boolean |
isValidColumnName(String columnName)
Check if a given string is valid to be used as a column name in the current database. |
boolean |
isValidTableName(String tableName)
Check if a given string is valid to be used as a table name in the current database. |
String |
ln(String value)
Get the function call that takes the natural logarithm of a value. |
String |
makeSafeCreateTable(String sql,
String catalog,
String schema,
String table)
Create a "safe" CREATE TABLE query string that will not fail if the table already exists. |
String |
power(String base,
String exponent)
Get the function call that calculates base
raised to the power of exponent
For example: POW(base, value) |
String |
rlike(String value,
String regexp)
Get a function/expression that matches the left value against the right value which should be a regular expression. |
boolean |
selectOrderByColumnsIfDistinct()
If the database requires that columns appearing in the ORDER BY part of the query must also be part of the SELECT list when using the DISTINCT keyword. |
boolean |
supportColumnAliasInGroupBy()
If the current database supports column aliases in the group by part of a query or not. |
boolean |
supportColumnAliasInHaving()
If the current database supports column aliases in the order by part of a query or not. |
boolean |
supportColumnAliasInOrderBy()
If the current database supports column aliases in the order by part of a query or not. |
boolean |
supportsColumnAliasInWhere()
If the current database supports column aliases in the where part of a query or not. |
boolean |
useThetaJoin()
If the database uses theta join or ansi join. |
Method Detail |
---|
boolean useThetaJoin()
String getCreateIndexSql(String catalog, String schema, String table, String name, Set<String> columns, boolean unique)
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the index to be createdcolumns
- The name of the columns in the indexunique
- If the index must contain unique values or not
String getDropIndexSql(String catalog, String schema, String table, String name, boolean unique)
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the tablename
- The name of the indexunique
- If the index contains unique values or not
boolean analyzeAfterBatchOperation()
getAnalyzeTableSql(String, String, String)
for that table.
Postgres, for example, almost always require that an analysis is run since subsequent queries otherwise may take a long time to execute if indexes can't be used properly.
String getOptimizeTableSql(String catalog, String schema, String table)
MySQL: OPTIMIZE TABLE <table> Postgres: VACCUUM <table>NOTE! The SQL returned by this method may impact the performance on the database. It is only intended to be executed when there is a need to clean up the database. How often this is needed depends on the database.
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to optimize
getAnalyzeTableSql(String, String, String)
String getAnalyzeTableSql(String catalog, String schema, String table)
MySQL: ANALYZE TABLE <table> Postgres: ANALYZE <table>NOTE! The SQL returned by this method must be able to run within a transaction and from multiple transactions on the same table at the same time. If no such SQL statement exists null should be returned.
catalog
- The name of the catalog (database) where the table is
located, or null if it is located in the current catalogschema
- The name of the schema where the table is located, or
null if is located in the current schematable
- The name of the table to analyze
getOptimizeTableSql(String, String, String)
String makeSafeCreateTable(String sql, String catalog, String schema, String table)
sql
- The original SQLcatalog
- The name of the catalog (database) where the table is
being create, or null if it is located in the current catalogschema
- The name of the schema where the table is being created, or
null if is located in the current schematable
- The name of the table that is being created
boolean caseInsensitiveComparison()
boolean supportsColumnAliasInWhere()
SELECT tbl.blah as foo, ... FROM Table tbl WHERE foo = 2
If not supported the entire expression will be used again.
boolean supportColumnAliasInOrderBy()
SELECT tbl.blah as foo, ... FROM Table tbl ORDER BY foo
If not supported the entire expression will be used again.
boolean supportColumnAliasInGroupBy()
SELECT tbl.blah as foo, ... FROM Table tbl GROUP BY foo
If not supported the entire expression will be used again.
boolean supportColumnAliasInHaving()
SELECT count(tbl.blah) as foo, ... FROM Table tbl
GROUP BY ... HAVING foo = 2
If not supported the entire expression will be used again.
boolean selectOrderByColumnsIfDistinct()
boolean checkForInvalidNumberOperation()
CASE...WHEN
statement to the query for
Postgres. Example:
CASE WHEN denominator = 0 THEN null ELSE numerator / denominator
String ln(String value)
LN(value)
value
- The value to take the logarithm of
UnsupportedOperationException
- If the database doesn't support
logarithmsString abs(String value)
ABS(value)
value
- The value to use in the calculation
UnsupportedOperationException
- If the database doesn't support
this functionString exp(String value)
EXP(value)
value
- The value to use in the calculation
UnsupportedOperationException
- If the database doesn't support
this functionString power(String base, String exponent)
base
raised to the power of exponent
For example: POW(base, value)
base
- The base in the expressionexponent
- The exponent in the expression
UnsupportedOperationException
- If the database doesn't support
this functionString rlike(String value, String regexp)
value
- The left valueregexp
- The regular expression as a string
String castToDate(String value)
value
- The value to cast
boolean isValidTableName(String tableName)
tableName
- The string to check
boolean isValidColumnName(String columnName)
columnName
- The string to check
String getCaseSensitiveVarchar(int length)
length
- The maximum length that needs to be stored in the column
String inspectSchemaGenerationSQL(String sql, org.hibernate.dialect.Dialect dialect, boolean update)
SchemaGenerator
class
when creating or updating a database.
sql
- The original SQL statment as generated by Hibernatedialect
- The Hibernate dialect currently in useupdate
- TRUE if we are updating an existing database,
FALSE if we are creating a new one
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |