Package org.jumpmind.db.platform
Class AbstractDatabasePlatform
java.lang.Object
org.jumpmind.db.platform.AbstractDatabasePlatform
- All Implemented Interfaces:
IDatabasePlatform
- Direct Known Subclasses:
AbstractJdbcDatabasePlatform
,CassandraPlatform
,KafkaPlatform
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected long
protected DatabaseVersion
protected IDdlBuilder
protected IDdlReader
protected String
protected String
protected final org.slf4j.Logger
protected boolean
protected static final String
protected static final String
static final String
protected SqlTemplateSettings
protected String
protected Boolean
protected Boolean
protected Boolean
protected Boolean
protected Boolean
protected boolean
protected boolean
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
String[]
alterCaseToMatchDatabaseDefaultCase
(String[] values) void
alterCaseToMatchDatabaseDefaultCase
(Database database) void
void
alterCaseToMatchDatabaseDefaultCase
(Table... tables) void
alterDatabase
(Database desiredDatabase, String triggerPrefix, boolean continueOnError) void
alterDatabase
(Database desiredDatabase, String triggerPrefix, boolean continueOnError, IAlterDatabaseInterceptor[] interceptors) void
alterTables
(boolean continueOnError, boolean createTableIncludeApplicationTriggers, String triggerPrefix, IAlterDatabaseInterceptor[] interceptors, Table... desiredTables) void
alterTables
(boolean continueOnError, Table... desiredTables) protected void
appendString
(StringBuilder sb, String value) boolean
canColumnBeUsedInWhereClause
(Column column) checkSymTablePermissions
(PermissionType... permissionTypes) protected String
cleanNumber
(String value) protected String
protected Array
createArray
(Column column, String value) void
createDatabase
(Database targetDatabase, boolean dropTablesFirst, boolean continueOnError) createDmlStatement
(DmlStatement.DmlType dmlType, String catalogName, String schemaName, String tableName, Column[] keys, Column[] columns, boolean[] nullKeyValues, String textColumnExpression) createDmlStatement
(DmlStatement.DmlType dmlType, String catalogName, String schemaName, String tableName, Column[] keys, Column[] columns, boolean[] nullKeyValues, String textColumnExpression, boolean namedParameters) createDmlStatement
(DmlStatement.DmlType dmlType, Table table, String textColumnExpression) createDmlStatement
(DmlStatementOptions options) void
createTables
(boolean dropTablesFirst, boolean continueOnError, Table... tables) void
dropDatabase
(Database database, boolean continueOnError) void
dropTables
(boolean continueOnError, Table... tables) protected PermissionResult
getAlterSymTablePermission
(Database database) long
protected PermissionResult
protected PermissionResult
protected PermissionResult
getCreateSymTablePermission
(Database database) protected PermissionResult
getCsvStringValue
(BinaryEncoding encoding, Column[] metaData, Row row, boolean[] isColumnPositionUsingTemplate) Returns information about this platform.protected String
getDateTimeStringValue
(String name, int type, Row row, boolean useVariableDates) Returns a new ddl builder for the this platform.Returns the ddl reader (which reads a database model from a live database) for this platform.getDeleteSql
(Table table) protected PermissionResult
protected PermissionResult
long
getEstimatedRowCount
(Table table) protected PermissionResult
getLobColumns
(Table table) protected Object
getObjectValue
(String value, Column column, BinaryEncoding encoding, boolean useVariableDates, boolean fitToColumn) Object[]
getObjectValues
(BinaryEncoding encoding, String[] values, Column[] orderedMetaData) Object[]
getObjectValues
(BinaryEncoding encoding, String[] values, Column[] orderedMetaData, boolean useVariableDates, boolean fitToColumn) Object[]
getObjectValues
(BinaryEncoding encoding, Table table, String[] columnNames, String[] values) Object[]
getObjectValues
(BinaryEncoding encoding, Table table, String[] columnNames, String[] values, boolean useVariableDates, boolean fitToColumn) protected Table
getSliceTableSql
(String columnName, int sliceNum, int totalSlices) abstract ISqlTemplate
abstract ISqlTemplate
String[]
getStringValues
(BinaryEncoding encoding, Column[] metaData, Row row, boolean useVariableDates, boolean indexByPosition) getTableFromCache
(String tableName, boolean forceReread) getTableFromCache
(String catalogName, String schemaName, String tableName, boolean forceReread) protected String
getTimestampStringValue
(String name, int type, Row row, boolean useVariableDates) protected String
getTimestampTzStringValue
(String name, int type, Row row, boolean useVariableDates) getTimeZone
(String value) getTruncateSql
(Table table) boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
protected void
logFailedResults
(List<PermissionResult> results) makeAllColumnsPrimaryKeys
(Table table) void
makePlatformSpecific
(Database database) massageForLimitOffset
(String sql, int limit, int offset) protected Object
parseBigDecimal
(String value) protected Object
parseBigInteger
(String value) protected Object
parseBoolean
(String value) protected Object
parseFloat
(String value) protected Object
parseInteger
(String value) parseQualifiedTableName
(String tableName) parseTimestamp
(int type, String value) protected void
prefixColumnNames
(Table table, boolean storesUpperCaseIdentifiers) void
prefixDatabase
(String prefix, Database targetTables) protected void
prefixForeignKeys
(Table table, String tablePrefix, boolean storesUpperCaseIdentifiers) protected void
prefixIndexes
(Table table, String tablePrefix, boolean storesUpperCaseIdentifiers) readDatabase
(String catalog, String schema, String[] tableTypes) Reads the database model from the live database to which the given connection is pointing.readDatabaseFromXml
(InputStream is, boolean alterCaseToMatchDatabaseDefaultCase) readDatabaseFromXml
(String filePath, boolean alterCaseToMatchDatabaseDefaultCase) readFromDatabase
(Table... tables) readTableFromDatabase
(String catalogName, String schemaName, String tableName) readTableFromDatabase
(ISqlTransaction transaction, String catalogName, String schemaName, String tableName) protected Table
readTableFromDatabaseAllowException
(String catalogName, String schemaName, String tableName) void
void
setClearCacheModelTimeoutInMs
(long clearCacheModelTimeoutInMs) The amount of time table metadata will be cached when usingIDatabasePlatform#getT
void
setDatabaseVersion
(DatabaseVersion databaseVersion) void
setMetadataIgnoreCase
(boolean metadataIgnoreCase) boolean
boolean
boolean
boolean
boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jumpmind.db.platform.IDatabasePlatform
getDataSource, getDefaultCatalog, getDefaultSchema, getName
-
Field Details
-
log
protected final org.slf4j.Logger log -
REQUIRED_FIELD_NULL_SUBSTITUTE
- See Also:
-
ZERO_DATE_STRING
- See Also:
-
MODEL_DEFAULT_NAME
- See Also:
-
PERMISSION_TEST_TABLE_NAME
- See Also:
-
ddlReader
-
ddlBuilder
-
tableCache
-
clearCacheModelTimeoutInMs
protected long clearCacheModelTimeoutInMs -
defaultSchema
-
defaultCatalog
-
storesUpperCaseIdentifiers
-
storesLowerCaseIdentifiers
-
storesMixedCaseIdentifiers
-
metadataIgnoreCase
protected boolean metadataIgnoreCase -
useMultiThreadSyncTriggers
protected boolean useMultiThreadSyncTriggers -
settings
-
supportsTransactions
-
supportsMultiThreadedTransactions
-
supportsTruncate
protected boolean supportsTruncate -
sourceNodeId
-
databaseVersion
-
-
Constructor Details
-
AbstractDatabasePlatform
-
-
Method Details
-
getDatabaseInfo
Description copied from interface:IDatabasePlatform
Returns information about this platform.- Specified by:
getDatabaseInfo
in interfaceIDatabasePlatform
- Returns:
- The info object
-
getSqlTemplate
- Specified by:
getSqlTemplate
in interfaceIDatabasePlatform
-
getSqlTemplateDirty
- Specified by:
getSqlTemplateDirty
in interfaceIDatabasePlatform
-
createDmlStatement
public DmlStatement createDmlStatement(DmlStatement.DmlType dmlType, Table table, String textColumnExpression) - Specified by:
createDmlStatement
in interfaceIDatabasePlatform
-
createDmlStatement
public DmlStatement createDmlStatement(DmlStatement.DmlType dmlType, String catalogName, String schemaName, String tableName, Column[] keys, Column[] columns, boolean[] nullKeyValues, String textColumnExpression) - Specified by:
createDmlStatement
in interfaceIDatabasePlatform
-
createDmlStatement
public DmlStatement createDmlStatement(DmlStatement.DmlType dmlType, String catalogName, String schemaName, String tableName, Column[] keys, Column[] columns, boolean[] nullKeyValues, String textColumnExpression, boolean namedParameters) - Specified by:
createDmlStatement
in interfaceIDatabasePlatform
-
createDmlStatement
- Specified by:
createDmlStatement
in interfaceIDatabasePlatform
-
getDdlReader
Description copied from interface:IDatabasePlatform
Returns the ddl reader (which reads a database model from a live database) for this platform.- Specified by:
getDdlReader
in interfaceIDatabasePlatform
- Returns:
- The model reader
-
getDdlBuilder
Description copied from interface:IDatabasePlatform
Returns a new ddl builder for the this platform.- Specified by:
getDdlBuilder
in interfaceIDatabasePlatform
-
setClearCacheModelTimeoutInMs
public void setClearCacheModelTimeoutInMs(long clearCacheModelTimeoutInMs) Description copied from interface:IDatabasePlatform
The amount of time table metadata will be cached when usingIDatabasePlatform#getT
- Specified by:
setClearCacheModelTimeoutInMs
in interfaceIDatabasePlatform
-
getClearCacheModelTimeoutInMs
public long getClearCacheModelTimeoutInMs()- Specified by:
getClearCacheModelTimeoutInMs
in interfaceIDatabasePlatform
-
dropTables
- Specified by:
dropTables
in interfaceIDatabasePlatform
-
dropDatabase
- Specified by:
dropDatabase
in interfaceIDatabasePlatform
-
createTables
- Specified by:
createTables
in interfaceIDatabasePlatform
-
createDatabase
public void createDatabase(Database targetDatabase, boolean dropTablesFirst, boolean continueOnError) - Specified by:
createDatabase
in interfaceIDatabasePlatform
-
alterDatabase
public void alterDatabase(Database desiredDatabase, String triggerPrefix, boolean continueOnError, IAlterDatabaseInterceptor[] interceptors) - Specified by:
alterDatabase
in interfaceIDatabasePlatform
-
alterDatabase
- Specified by:
alterDatabase
in interfaceIDatabasePlatform
-
alterTables
- Specified by:
alterTables
in interfaceIDatabasePlatform
-
alterTables
public void alterTables(boolean continueOnError, boolean createTableIncludeApplicationTriggers, String triggerPrefix, IAlterDatabaseInterceptor[] interceptors, Table... desiredTables) - Specified by:
alterTables
in interfaceIDatabasePlatform
-
readDatabase
Description copied from interface:IDatabasePlatform
Reads the database model from the live database to which the given connection is pointing.- Specified by:
readDatabase
in interfaceIDatabasePlatform
-
readFromDatabase
- Specified by:
readFromDatabase
in interfaceIDatabasePlatform
-
readTableFromDatabase
- Specified by:
readTableFromDatabase
in interfaceIDatabasePlatform
-
readTableFromDatabaseAllowException
-
readTableFromDatabase
public Table readTableFromDatabase(ISqlTransaction transaction, String catalogName, String schemaName, String tableName) - Specified by:
readTableFromDatabase
in interfaceIDatabasePlatform
-
resetCachedTableModel
public void resetCachedTableModel()- Specified by:
resetCachedTableModel
in interfaceIDatabasePlatform
-
getTableFromCache
- Specified by:
getTableFromCache
in interfaceIDatabasePlatform
-
getTableFromCache
public Table getTableFromCache(String catalogName, String schemaName, String tableName, boolean forceReread) - Specified by:
getTableFromCache
in interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, Table table, String[] columnNames, String[] values) - Specified by:
getObjectValues
in interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, Table table, String[] columnNames, String[] values, boolean useVariableDates, boolean fitToColumn) - Specified by:
getObjectValues
in interfaceIDatabasePlatform
-
getObjectValues
- Specified by:
getObjectValues
in interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, String[] values, Column[] orderedMetaData, boolean useVariableDates, boolean fitToColumn) - Specified by:
getObjectValues
in interfaceIDatabasePlatform
-
getObjectValue
protected Object getObjectValue(String value, Column column, BinaryEncoding encoding, boolean useVariableDates, boolean fitToColumn) throws org.apache.commons.codec.DecoderException - Throws:
org.apache.commons.codec.DecoderException
-
parseFloat
-
parseBigDecimal
-
parseBigInteger
-
parseInteger
-
parseBoolean
-
cleanNumber
-
getStringValues
public String[] getStringValues(BinaryEncoding encoding, Column[] metaData, Row row, boolean useVariableDates, boolean indexByPosition) - Specified by:
getStringValues
in interfaceIDatabasePlatform
-
getCsvStringValue
public String getCsvStringValue(BinaryEncoding encoding, Column[] metaData, Row row, boolean[] isColumnPositionUsingTemplate) - Specified by:
getCsvStringValue
in interfaceIDatabasePlatform
-
appendString
-
getDateTimeStringValue
-
getTimestampStringValue
-
getTimestampTzStringValue
-
getSqlScriptReplacementTokens
- Specified by:
getSqlScriptReplacementTokens
in interfaceIDatabasePlatform
-
scrubSql
- Specified by:
scrubSql
in interfaceIDatabasePlatform
-
createArray
-
cleanTextForTextBasedColumns
-
parseDate
- Specified by:
parseDate
in interfaceIDatabasePlatform
-
parseQualifiedTableName
- Specified by:
parseQualifiedTableName
in interfaceIDatabasePlatform
-
makeAllColumnsPrimaryKeys
- Specified by:
makeAllColumnsPrimaryKeys
in interfaceIDatabasePlatform
-
isLob
- Specified by:
isLob
in interfaceIDatabasePlatform
-
isClob
- Specified by:
isClob
in interfaceIDatabasePlatform
-
isBlob
- Specified by:
isBlob
in interfaceIDatabasePlatform
-
getLobColumns
- Specified by:
getLobColumns
in interfaceIDatabasePlatform
-
setMetadataIgnoreCase
public void setMetadataIgnoreCase(boolean metadataIgnoreCase) - Specified by:
setMetadataIgnoreCase
in interfaceIDatabasePlatform
-
isMetadataIgnoreCase
public boolean isMetadataIgnoreCase()- Specified by:
isMetadataIgnoreCase
in interfaceIDatabasePlatform
-
isStoresLowerCaseIdentifiers
public boolean isStoresLowerCaseIdentifiers()- Specified by:
isStoresLowerCaseIdentifiers
in interfaceIDatabasePlatform
-
isStoresMixedCaseQuotedIdentifiers
public boolean isStoresMixedCaseQuotedIdentifiers()- Specified by:
isStoresMixedCaseQuotedIdentifiers
in interfaceIDatabasePlatform
-
isStoresUpperCaseIdentifiers
public boolean isStoresUpperCaseIdentifiers()- Specified by:
isStoresUpperCaseIdentifiers
in interfaceIDatabasePlatform
-
readDatabaseFromXml
- Specified by:
readDatabaseFromXml
in interfaceIDatabasePlatform
-
prefixDatabase
- Specified by:
prefixDatabase
in interfaceIDatabasePlatform
-
prefixColumnNames
-
prefixForeignKeys
protected void prefixForeignKeys(Table table, String tablePrefix, boolean storesUpperCaseIdentifiers) throws CloneNotSupportedException - Throws:
CloneNotSupportedException
-
prefixIndexes
protected void prefixIndexes(Table table, String tablePrefix, boolean storesUpperCaseIdentifiers) throws CloneNotSupportedException - Throws:
CloneNotSupportedException
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCase
in interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCase
in interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCase
in interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCase
in interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCase
in interfaceIDatabasePlatform
-
readDatabaseFromXml
- Specified by:
readDatabaseFromXml
in interfaceIDatabasePlatform
-
canColumnBeUsedInWhereClause
- Specified by:
canColumnBeUsedInWhereClause
in interfaceIDatabasePlatform
-
parseTimestamp
-
getTimeZone
-
makePlatformSpecific
- Specified by:
makePlatformSpecific
in interfaceIDatabasePlatform
-
hasMatchingPlatform
- Specified by:
hasMatchingPlatform
in interfaceIDatabasePlatform
-
checkSymTablePermissions
- Specified by:
checkSymTablePermissions
in interfaceIDatabasePlatform
-
logFailedResults
-
getPermissionTableDefinition
-
getCreateSymTablePermission
-
getDropSymTablePermission
-
getAlterSymTablePermission
-
getDropSymTriggerPermission
-
getCreateSymTriggerPermission
-
getExecuteSymPermission
-
getCreateSymRoutinePermission
-
getCreateSymFunctionPermission
-
getLogMinePermission
- Specified by:
getLogMinePermission
in interfaceIDatabasePlatform
-
isUseMultiThreadSyncTriggers
public boolean isUseMultiThreadSyncTriggers()- Specified by:
isUseMultiThreadSyncTriggers
in interfaceIDatabasePlatform
-
supportsTransactions
public boolean supportsTransactions()- Specified by:
supportsTransactions
in interfaceIDatabasePlatform
-
supportsMultiThreadedTransactions
public boolean supportsMultiThreadedTransactions()- Specified by:
supportsMultiThreadedTransactions
in interfaceIDatabasePlatform
-
getEstimatedRowCount
- Specified by:
getEstimatedRowCount
in interfaceIDatabasePlatform
-
getTruncateSql
- Specified by:
getTruncateSql
in interfaceIDatabasePlatform
-
getDeleteSql
- Specified by:
getDeleteSql
in interfaceIDatabasePlatform
-
getTransactions
- Specified by:
getTransactions
in interfaceIDatabasePlatform
-
supportsLimitOffset
public boolean supportsLimitOffset()- Specified by:
supportsLimitOffset
in interfaceIDatabasePlatform
-
massageForLimitOffset
- Specified by:
massageForLimitOffset
in interfaceIDatabasePlatform
-
massageForObjectAlreadyExists
- Specified by:
massageForObjectAlreadyExists
in interfaceIDatabasePlatform
-
massageForObjectDoesNotExist
- Specified by:
massageForObjectDoesNotExist
in interfaceIDatabasePlatform
-
supportsSliceTables
public boolean supportsSliceTables()- Specified by:
supportsSliceTables
in interfaceIDatabasePlatform
-
getSliceTableSql
- Specified by:
getSliceTableSql
in interfaceIDatabasePlatform
-
getCharSetName
- Specified by:
getCharSetName
in interfaceIDatabasePlatform
-
supportsParametersInSelect
public boolean supportsParametersInSelect()- Specified by:
supportsParametersInSelect
in interfaceIDatabasePlatform
-
allowsUniqueIndexDuplicatesWithNulls
public boolean allowsUniqueIndexDuplicatesWithNulls()- Specified by:
allowsUniqueIndexDuplicatesWithNulls
in interfaceIDatabasePlatform
-
getDatabaseVersion
- Specified by:
getDatabaseVersion
in interfaceIDatabasePlatform
-
setDatabaseVersion
- Specified by:
setDatabaseVersion
in interfaceIDatabasePlatform
-