Package net.sf.basedb.core.dbengine
Class DefaultDbEngine
java.lang.Object
net.sf.basedb.core.dbengine.AbstractDbEngine
net.sf.basedb.core.dbengine.DefaultDbEngine
- All Implemented Interfaces:
DbEngine
A default DbEngine that is selected if no other can be found. This
probably has some issues with most databases.
- Version:
- 2.0
- Author:
- nicklas
- Last modified
- $Date: 2016-02-15 11:58:10 +0100 (må, 15 feb 2016) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Return false.boolean
Returns TRUE.getAnalyzeTableSql
(String catalog, String schema, String table) Return null.getCreateForeignKeySql
(String catalog, String schema, String table, String name, Set<String> columns, String refTable, Set<String> refColumns) Generates SQL that creates a foreign key constraint between two tables.getCreateIndexSql
(String catalog, String schema, String table, String name, Set<String> columns, boolean unique) Generatescreate [unique] index <name> on <catalog>.<schema>.<table> (<columns>)
which should work for most databases.getCreatePrimaryKeySql
(String catalog, String schema, String table, String name, Set<String> columns) Generate SQL to create a primary key for a table.getCreateSchemaSql
(String catalog, String schema) Generatecreate schema <catalog>.<schema>
.getDropForeignKeySql
(String catalog, String schema, String table, String name) Generatealter table <catalog>.<schema>.<table> drop constraint <name>
getDropIndexSql
(String catalog, String schema, String table, String name, boolean unique) Generatedrop index <catalog>.<schema>.<table>.<name>
.getDropPrimaryKey
(String catalog, String schema, String table, String name) Generate SQL that drops the primary key from a table.Return a SQL fragment that can be used in an INSERT INTO statement to generate an ID for new rows.getOptimizeTableSql
(String catalog, String schema, String table) Return null.Methods inherited from class net.sf.basedb.core.dbengine.AbstractDbEngine
abs, castToDate, checkForInvalidNumberOperation, dropForeignKeysUsedInIndex, exp, getApproximateRowCountSql, getCaseSensitiveVarchar, getCatalogName, getCreatePartialIndexSql, getMaxParametersInQuery, getQuotedName, getSchemaName, inspectSchemaGenerationSQL, isValidColumnName, isValidName, isValidTableName, ln, makeSafeCreateTable, power, rlike, selectOrderByColumnsIfDistinct, supportColumnAliasInGroupBy, supportColumnAliasInHaving, supportColumnAliasInOrderBy, supportsColumnAliasInWhere, useSavePointToContinueTransactionFromSqlFailure, useThetaJoin
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.dbengine.DbEngine
getCreateTemporaryIdTable
-
Constructor Details
-
DefaultDbEngine
public DefaultDbEngine()Create DefaultDbEngine.
-
-
Method Details
-
getCreateSchemaSql
Generatecreate schema <catalog>.<schema>
.- Since:
- 3.4
-
getCreateIndexSql
public String getCreateIndexSql(String catalog, String schema, String table, String name, Set<String> columns, boolean unique) Generatescreate [unique] index <name> on <catalog>.<schema>.<table> (<columns>)
which should work for most databases.- Parameters:
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- Returns:
- The SQL to execute
-
getDropIndexSql
public String getDropIndexSql(String catalog, String schema, String table, String name, boolean unique) Generatedrop index <catalog>.<schema>.<table>.<name>
.- Parameters:
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- Returns:
- The SQL to execute
-
getDropForeignKeySql
Generatealter table <catalog>.<schema>.<table> drop constraint <name>
- Parameters:
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 foreign key- Returns:
- The SQL to execute
- Since:
- 3.0
-
getInsertAutoIncrementSql
Description copied from interface:DbEngine
Return a SQL fragment that can be used in an INSERT INTO statement to generate an ID for new rows.- Parameters:
pc
- The persistent class- Returns:
- Always "null" (assuming that the database knows how to generate the id)
-
analyzeAfterBatchOperation
public boolean analyzeAfterBatchOperation()Return false. -
getOptimizeTableSql
Return null.- Parameters:
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- Returns:
- The SQL to execute
- See Also:
-
getAnalyzeTableSql
Return null.- Parameters:
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- Returns:
- The SQL to execute, or null if not supported
- See Also:
-
caseInsensitiveComparison
public boolean caseInsensitiveComparison()Returns TRUE.- Returns:
- FALSE if comparisons are case sensitive (ABC != abc), TRUE if they are case insensitive (ABC = abc)
- Since:
- 2.4
-
getCreateForeignKeySql
public String getCreateForeignKeySql(String catalog, String schema, String table, String name, Set<String> columns, String refTable, Set<String> refColumns) Description copied from interface:DbEngine
Generates SQL that creates a foreign key constraint between two tables. Note! When calling this method, ensure that the Set:s with columns have a predictable iteration order!- Parameters:
catalog
- The name of the catalog (database) where the tables are located, or null if it is located in the current catalogschema
- The name of the schema where the tables are located, or null if is located in the current schematable
- The name of the foreign key tablename
- The name of the foreign keycolumns
- The columns that make up the foreign keyrefTable
- The table that is referenced by the foreign keyrefColumns
- The columns that are referenced by the foreign key- Returns:
- The SQL to create the foreign key
-
getCreatePrimaryKeySql
public String getCreatePrimaryKeySql(String catalog, String schema, String table, String name, Set<String> columns) Description copied from interface:DbEngine
Generate SQL to create a primary key for a table. Note! When calling this method, ensure that the column set have a predictable iteration order!- Parameters:
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 primary keycolumns
- The name of the columns in the primary key- Returns:
- The SQL to execute
-
getDropPrimaryKey
Description copied from interface:DbEngine
Generate SQL that drops the primary key from a table.- Parameters:
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 primary key- Returns:
- The SQL to execute
-