Class AbstractDatabaseType
java.lang.Object
org.ofbiz.core.entity.jdbc.dbtype.AbstractDatabaseType
- All Implemented Interfaces:
DatabaseType,ReservedKeywordsAware
- Direct Known Subclasses:
AbstractPostgresDatabaseType,Hsql233DatabaseType,HsqlDatabaseType,Oracle10GDatabaseType,SapDB76DatabaseType,SapDBDatabaseType,SimpleDatabaseType
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface org.ofbiz.core.entity.jdbc.dbtype.DatabaseType
STANDARD_SELECT_SYNTAXFields inherited from interface org.ofbiz.core.entity.jdbc.sql.escape.ReservedKeywordsAware
END_ESCAPE_CHARACTER_SQUARE_BRACKET, ESCAPE_CHARACTER_BACK_TICK, ESCAPE_CHARACTER_DOUBLE_QUOTE, START_ESCAPE_CHARACTER_SQUARE_BRACKET -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractDatabaseType(String name, String fieldTypeName, String[] productNamePrefix) protectedAbstractDatabaseType(String name, String fieldTypeName, String[] productNamePrefix, int constraintNameClipLength) -
Method Summary
Modifier and TypeMethodDescriptionbooleanfinal StringgetChangeColumnTypeSQL(String tableName, String columnName, String targetSqlType) Builds a DB-specific SQL statement to update a column's type.protected StringintgetDropIndexSQL(String schemaName, String tableName, String indexName) Builds a DB-specific SQL statement for dropping index.getName()getSchemaName(Connection con) Returns the name of the connected schema.inthashCode()initialize(Connection con) protected static booleanisProductNameInPrefixList(String[] productNamePrefixes, String productName) abstract booleanChecks whether the connection object passed in matches the database type represented by this instance of the DatabaseType class.protected booleanprotected static booleanproductNamesMatch(String productNamePrefix, String testName) protected voidRegister this database type with DatabaseTypeFactorytoString()protected static booleanversionGreaterThanOrEqual(int major1, int minor1, int major2, int minor2) Compares two version numbers and returns true if the first version number is greater than the secondprotected booleanversionGreaterThanOrEqual(Connection con, int majorVersion, int minorVersion) protected booleanversionLessThanOrEqual(Connection con, int majorVersion, int minorVersion) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ofbiz.core.entity.jdbc.dbtype.DatabaseType
getSimpleSelectSqlSyntaxMethods inherited from interface org.ofbiz.core.entity.jdbc.sql.escape.ReservedKeywordsAware
enableEscaping, escapeColumnName, getEndEscapeCharacter, getStartEscapeCharacter
-
Field Details
-
CHANGE_COLUMN_TYPE_CLAUSE_STRUCTURE_STANDARD_ALTER_COLUMN
- See Also:
-
CHANGE_COLUMN_TYPE_CLAUSE_STRUCTURE_STANDARD_MODIFY
- See Also:
-
DROP_INDEX_SCHEMA_DOT_INDEX
- See Also:
-
DROP_INDEX_SCHEMA_DOT_TABLE_DOT_INDEX
- See Also:
-
ALTER_TABLE_DROP_INDEX
- See Also:
-
STANDARD_SELECT_FOR_UPDATE_SYNTAX
- See Also:
-
-
Constructor Details
-
AbstractDatabaseType
-
AbstractDatabaseType
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceDatabaseType- Returns:
- A human readable version of the database type name
-
getFieldTypeName
- Specified by:
getFieldTypeNamein interfaceDatabaseType- Returns:
- The value that should be used for the field-type-name for a database of this type.
-
toString
-
getSchemaName
Description copied from interface:DatabaseTypeReturns the name of the connected schema.- Specified by:
getSchemaNamein interfaceDatabaseType- Parameters:
con- the connection for which to return the schema- Returns:
- null if a schema name is not available
-
getConstraintNameClipLength
public int getConstraintNameClipLength()- Specified by:
getConstraintNameClipLengthin interfaceDatabaseType
-
matchesConnection
Checks whether the connection object passed in matches the database type represented by this instance of the DatabaseType class.- Specified by:
matchesConnectionin interfaceDatabaseType- Returns:
- true if the Connection matches this DatabaseType instance.
- Throws:
SQLException
-
registerWithFactory
protected void registerWithFactory()Register this database type with DatabaseTypeFactory -
versionGreaterThanOrEqual
protected static boolean versionGreaterThanOrEqual(int major1, int minor1, int major2, int minor2) Compares two version numbers and returns true if the first version number is greater than the second- Parameters:
major1- First major version number for comparisonminor1- First minor version number for comparisonmajor2- Second major version number for comparisonminor2- Second minor version number for comparison- Returns:
- True if (major1, minor1) > (major2, minor2) otherwise false
-
productNamesMatch
-
isProductNameInPrefixList
-
productNameMatches
- Throws:
SQLException
-
versionGreaterThanOrEqual
protected boolean versionGreaterThanOrEqual(Connection con, int majorVersion, int minorVersion) throws SQLException - Throws:
SQLException
-
versionLessThanOrEqual
protected boolean versionLessThanOrEqual(Connection con, int majorVersion, int minorVersion) throws SQLException - Throws:
SQLException
-
getChangeColumnTypeStructure
- Returns:
- a format string to compose an SQL query to change a column in DB.
-
getChangeColumnTypeSQL
public final String getChangeColumnTypeSQL(String tableName, String columnName, String targetSqlType) Builds a DB-specific SQL statement to update a column's type.- Specified by:
getChangeColumnTypeSQLin interfaceDatabaseType- Parameters:
tableName- the name of the table to be changed.columnName- the name of the column to be changed.targetSqlType- the target SQL type of the column.- Returns:
- the SQL text to change the column, or
null, if not supported.
-
getDropIndexStructure
- Returns:
- a format string to compose an SQL query to drop index in DB.
-
getDropIndexSQL
Builds a DB-specific SQL statement for dropping index.- Specified by:
getDropIndexSQLin interfaceDatabaseType- Parameters:
schemaName- the of the schema containing table.tableName- the name of the table to be changed.indexName- the name of the index to be dropped.- Returns:
- the SQL text to drop the index.
-
initialize
- Specified by:
initializein interfaceDatabaseType
-
getReservedKeywords
- Specified by:
getReservedKeywordsin interfaceReservedKeywordsAware
-
equals
-
hashCode
public int hashCode()
-