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 longprotected IDdlBuilderprotected IDdlReaderprotected Stringprotected Stringprotected final org.slf4j.Loggerprotected booleanprotected static final Stringprotected static final Stringstatic final Stringprotected SqlTemplateSettingsprotected Stringprotected Booleanprotected Booleanprotected Booleanprotected Booleanprotected Booleanprotected booleanprotected booleanstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanString[]alterCaseToMatchDatabaseDefaultCase(String[] values) voidalterCaseToMatchDatabaseDefaultCase(Database database) voidvoidalterCaseToMatchDatabaseDefaultCase(Table... tables) voidalterDatabase(Database desiredDatabase, boolean continueOnError) voidalterDatabase(Database desiredDatabase, boolean continueOnError, IAlterDatabaseInterceptor[] interceptors) voidalterTables(boolean continueOnError, Table... desiredTables) voidalterTables(boolean continueOnError, IAlterDatabaseInterceptor[] interceptors, Table... desiredTables) protected voidappendString(StringBuilder sb, String value) booleancanColumnBeUsedInWhereClause(Column column) checkSymTablePermissions(PermissionType... permissionTypes) protected StringcleanNumber(String value) protected Stringprotected ArraycreateArray(Column column, String value) voidcreateDatabase(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) voidcreateTables(boolean dropTablesFirst, boolean continueOnError, Table... tables) voiddropDatabase(Database database, boolean continueOnError) voiddropTables(boolean continueOnError, Table... tables) protected PermissionResultgetAlterSymTablePermission(Database database) longprotected PermissionResultprotected PermissionResultprotected PermissionResultgetCreateSymTablePermission(Database database) protected PermissionResultgetCsvStringValue(BinaryEncoding encoding, Column[] metaData, Row row, boolean[] isColumnPositionUsingTemplate) Returns information about this platform.protected StringgetDateTimeStringValue(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 PermissionResultprotected PermissionResultlonggetEstimatedRowCount(Table table) protected PermissionResultgetLobColumns(Table table) protected ObjectgetObjectValue(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 TablegetSliceTableSql(String columnName, int sliceNum, int totalSlices) abstract ISqlTemplateabstract ISqlTemplateString[]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 StringgetTimestampStringValue(String name, int type, Row row, boolean useVariableDates) protected StringgetTimestampTzStringValue(String name, int type, Row row, boolean useVariableDates) getTimeZone(String value) getTruncateSql(Table table) booleanbooleanisBlob(int type) booleanisClob(int type) booleanisLob(int type) booleanbooleanbooleanbooleanbooleanprotected voidlogFailedResults(List<PermissionResult> results) makeAllColumnsPrimaryKeys(Table table) voidmakePlatformSpecific(Database database) massageForLimitOffset(String sql, int limit, int offset) protected ObjectparseBigDecimal(String value) protected ObjectparseBigInteger(String value) protected ObjectparseFloat(String value) protected ObjectparseInteger(String value) parseQualifiedTableName(String tableName) parseTimestamp(int type, String value) protected voidprefixColumnNames(Table table, boolean storesUpperCaseIdentifiers) voidprefixDatabase(String prefix, Database targetTables) protected voidprefixForeignKeys(Table table, String tablePrefix, boolean storesUpperCaseIdentifiers) protected voidprefixIndexes(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 TablereadTableFromDatabaseAllowException(String catalogName, String schemaName, String tableName) voidvoidsetClearCacheModelTimeoutInMs(long clearCacheModelTimeoutInMs) The amount of time table metadata will be cached when usingIDatabasePlatform#getTvoidsetMetadataIgnoreCase(boolean metadataIgnoreCase) booleanbooleanbooleanbooleanbooleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
-
Constructor Details
-
AbstractDatabasePlatform
-
-
Method Details
-
getDatabaseInfo
Description copied from interface:IDatabasePlatformReturns information about this platform.- Specified by:
getDatabaseInfoin interfaceIDatabasePlatform- Returns:
- The info object
-
getSqlTemplate
- Specified by:
getSqlTemplatein interfaceIDatabasePlatform
-
getSqlTemplateDirty
- Specified by:
getSqlTemplateDirtyin interfaceIDatabasePlatform
-
createDmlStatement
public DmlStatement createDmlStatement(DmlStatement.DmlType dmlType, Table table, String textColumnExpression) - Specified by:
createDmlStatementin interfaceIDatabasePlatform
-
createDmlStatement
public DmlStatement createDmlStatement(DmlStatement.DmlType dmlType, String catalogName, String schemaName, String tableName, Column[] keys, Column[] columns, boolean[] nullKeyValues, String textColumnExpression) - Specified by:
createDmlStatementin 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:
createDmlStatementin interfaceIDatabasePlatform
-
createDmlStatement
- Specified by:
createDmlStatementin interfaceIDatabasePlatform
-
getDdlReader
Description copied from interface:IDatabasePlatformReturns the ddl reader (which reads a database model from a live database) for this platform.- Specified by:
getDdlReaderin interfaceIDatabasePlatform- Returns:
- The model reader
-
getDdlBuilder
Description copied from interface:IDatabasePlatformReturns a new ddl builder for the this platform.- Specified by:
getDdlBuilderin interfaceIDatabasePlatform
-
setClearCacheModelTimeoutInMs
public void setClearCacheModelTimeoutInMs(long clearCacheModelTimeoutInMs) Description copied from interface:IDatabasePlatformThe amount of time table metadata will be cached when usingIDatabasePlatform#getT- Specified by:
setClearCacheModelTimeoutInMsin interfaceIDatabasePlatform
-
getClearCacheModelTimeoutInMs
public long getClearCacheModelTimeoutInMs()- Specified by:
getClearCacheModelTimeoutInMsin interfaceIDatabasePlatform
-
dropTables
- Specified by:
dropTablesin interfaceIDatabasePlatform
-
dropDatabase
- Specified by:
dropDatabasein interfaceIDatabasePlatform
-
createTables
- Specified by:
createTablesin interfaceIDatabasePlatform
-
createDatabase
public void createDatabase(Database targetDatabase, boolean dropTablesFirst, boolean continueOnError) - Specified by:
createDatabasein interfaceIDatabasePlatform
-
alterDatabase
public void alterDatabase(Database desiredDatabase, boolean continueOnError, IAlterDatabaseInterceptor[] interceptors) - Specified by:
alterDatabasein interfaceIDatabasePlatform
-
alterDatabase
- Specified by:
alterDatabasein interfaceIDatabasePlatform
-
alterTables
- Specified by:
alterTablesin interfaceIDatabasePlatform
-
alterTables
public void alterTables(boolean continueOnError, IAlterDatabaseInterceptor[] interceptors, Table... desiredTables) - Specified by:
alterTablesin interfaceIDatabasePlatform
-
readDatabase
Description copied from interface:IDatabasePlatformReads the database model from the live database to which the given connection is pointing.- Specified by:
readDatabasein interfaceIDatabasePlatform
-
readFromDatabase
- Specified by:
readFromDatabasein interfaceIDatabasePlatform
-
readTableFromDatabase
- Specified by:
readTableFromDatabasein interfaceIDatabasePlatform
-
readTableFromDatabaseAllowException
-
readTableFromDatabase
public Table readTableFromDatabase(ISqlTransaction transaction, String catalogName, String schemaName, String tableName) - Specified by:
readTableFromDatabasein interfaceIDatabasePlatform
-
resetCachedTableModel
public void resetCachedTableModel()- Specified by:
resetCachedTableModelin interfaceIDatabasePlatform
-
getTableFromCache
- Specified by:
getTableFromCachein interfaceIDatabasePlatform
-
getTableFromCache
public Table getTableFromCache(String catalogName, String schemaName, String tableName, boolean forceReread) - Specified by:
getTableFromCachein interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, Table table, String[] columnNames, String[] values) - Specified by:
getObjectValuesin interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, Table table, String[] columnNames, String[] values, boolean useVariableDates, boolean fitToColumn) - Specified by:
getObjectValuesin interfaceIDatabasePlatform
-
getObjectValues
- Specified by:
getObjectValuesin interfaceIDatabasePlatform
-
getObjectValues
public Object[] getObjectValues(BinaryEncoding encoding, String[] values, Column[] orderedMetaData, boolean useVariableDates, boolean fitToColumn) - Specified by:
getObjectValuesin 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
-
cleanNumber
-
getStringValues
public String[] getStringValues(BinaryEncoding encoding, Column[] metaData, Row row, boolean useVariableDates, boolean indexByPosition) - Specified by:
getStringValuesin interfaceIDatabasePlatform
-
getCsvStringValue
public String getCsvStringValue(BinaryEncoding encoding, Column[] metaData, Row row, boolean[] isColumnPositionUsingTemplate) - Specified by:
getCsvStringValuein interfaceIDatabasePlatform
-
appendString
-
getDateTimeStringValue
-
getTimestampStringValue
-
getTimestampTzStringValue
-
getSqlScriptReplacementTokens
- Specified by:
getSqlScriptReplacementTokensin interfaceIDatabasePlatform
-
scrubSql
- Specified by:
scrubSqlin interfaceIDatabasePlatform
-
createArray
-
cleanTextForTextBasedColumns
-
parseDate
- Specified by:
parseDatein interfaceIDatabasePlatform
-
parseQualifiedTableName
- Specified by:
parseQualifiedTableNamein interfaceIDatabasePlatform
-
makeAllColumnsPrimaryKeys
- Specified by:
makeAllColumnsPrimaryKeysin interfaceIDatabasePlatform
-
isLob
public boolean isLob(int type) - Specified by:
isLobin interfaceIDatabasePlatform
-
isClob
public boolean isClob(int type) - Specified by:
isClobin interfaceIDatabasePlatform
-
isBlob
public boolean isBlob(int type) - Specified by:
isBlobin interfaceIDatabasePlatform
-
getLobColumns
- Specified by:
getLobColumnsin interfaceIDatabasePlatform
-
setMetadataIgnoreCase
public void setMetadataIgnoreCase(boolean metadataIgnoreCase) - Specified by:
setMetadataIgnoreCasein interfaceIDatabasePlatform
-
isMetadataIgnoreCase
public boolean isMetadataIgnoreCase()- Specified by:
isMetadataIgnoreCasein interfaceIDatabasePlatform
-
isStoresLowerCaseIdentifiers
public boolean isStoresLowerCaseIdentifiers()- Specified by:
isStoresLowerCaseIdentifiersin interfaceIDatabasePlatform
-
isStoresMixedCaseQuotedIdentifiers
public boolean isStoresMixedCaseQuotedIdentifiers()- Specified by:
isStoresMixedCaseQuotedIdentifiersin interfaceIDatabasePlatform
-
isStoresUpperCaseIdentifiers
public boolean isStoresUpperCaseIdentifiers()- Specified by:
isStoresUpperCaseIdentifiersin interfaceIDatabasePlatform
-
readDatabaseFromXml
- Specified by:
readDatabaseFromXmlin interfaceIDatabasePlatform
-
prefixDatabase
- Specified by:
prefixDatabasein 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:
alterCaseToMatchDatabaseDefaultCasein interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCasein interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCasein interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCasein interfaceIDatabasePlatform
-
alterCaseToMatchDatabaseDefaultCase
- Specified by:
alterCaseToMatchDatabaseDefaultCasein interfaceIDatabasePlatform
-
readDatabaseFromXml
- Specified by:
readDatabaseFromXmlin interfaceIDatabasePlatform
-
canColumnBeUsedInWhereClause
- Specified by:
canColumnBeUsedInWhereClausein interfaceIDatabasePlatform
-
parseTimestamp
-
getTimeZone
-
makePlatformSpecific
- Specified by:
makePlatformSpecificin interfaceIDatabasePlatform
-
hasMatchingPlatform
- Specified by:
hasMatchingPlatformin interfaceIDatabasePlatform
-
checkSymTablePermissions
- Specified by:
checkSymTablePermissionsin interfaceIDatabasePlatform
-
logFailedResults
-
getPermissionTableDefinition
-
getCreateSymTablePermission
-
getDropSymTablePermission
-
getAlterSymTablePermission
-
getDropSymTriggerPermission
-
getCreateSymTriggerPermission
-
getExecuteSymPermission
-
getCreateSymRoutinePermission
-
getCreateSymFunctionPermission
-
getLogMinePermission
- Specified by:
getLogMinePermissionin interfaceIDatabasePlatform
-
isUseMultiThreadSyncTriggers
public boolean isUseMultiThreadSyncTriggers()- Specified by:
isUseMultiThreadSyncTriggersin interfaceIDatabasePlatform
-
supportsTransactions
public boolean supportsTransactions()- Specified by:
supportsTransactionsin interfaceIDatabasePlatform
-
supportsMultiThreadedTransactions
public boolean supportsMultiThreadedTransactions()- Specified by:
supportsMultiThreadedTransactionsin interfaceIDatabasePlatform
-
getEstimatedRowCount
- Specified by:
getEstimatedRowCountin interfaceIDatabasePlatform
-
getTruncateSql
- Specified by:
getTruncateSqlin interfaceIDatabasePlatform
-
getDeleteSql
- Specified by:
getDeleteSqlin interfaceIDatabasePlatform
-
getTransactions
- Specified by:
getTransactionsin interfaceIDatabasePlatform
-
supportsLimitOffset
public boolean supportsLimitOffset()- Specified by:
supportsLimitOffsetin interfaceIDatabasePlatform
-
massageForLimitOffset
- Specified by:
massageForLimitOffsetin interfaceIDatabasePlatform
-
massageForObjectAlreadyExists
- Specified by:
massageForObjectAlreadyExistsin interfaceIDatabasePlatform
-
massageForObjectDoesNotExist
- Specified by:
massageForObjectDoesNotExistin interfaceIDatabasePlatform
-
supportsSliceTables
public boolean supportsSliceTables()- Specified by:
supportsSliceTablesin interfaceIDatabasePlatform
-
getSliceTableSql
- Specified by:
getSliceTableSqlin interfaceIDatabasePlatform
-
getCharSetName
- Specified by:
getCharSetNamein interfaceIDatabasePlatform
-
supportsParametersInSelect
public boolean supportsParametersInSelect()- Specified by:
supportsParametersInSelectin interfaceIDatabasePlatform
-
allowsUniqueIndexDuplicatesWithNulls
public boolean allowsUniqueIndexDuplicatesWithNulls()- Specified by:
allowsUniqueIndexDuplicatesWithNullsin interfaceIDatabasePlatform
-