Package com.liferay.portal.dao.db
Class BaseDB
Object
com.liferay.portal.dao.db.BaseDB
- All Implemented Interfaces:
com.liferay.portal.kernel.dao.db.DB
- Direct Known Subclasses:
HypersonicDB,MySQLDB,PostgreSQLDB
- Author:
- Alexander Chow, Ganesh Ram, Brian Wing Shun Chan, Daniel Kocsis
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Patternprotected static final Stringprotected static final Stringprotected static final Stringprotected static final String[]protected static final String[]protected static final int[]protected static final String[]Fields inherited from interface com.liferay.portal.kernel.dao.db.DB
SQL_SIZE_NONE, SQL_VARCHAR_MAX_SIZE, SQL_VARCHAR_MAX_SIZE_THRESHOLD -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseDB(com.liferay.portal.kernel.dao.db.DBType dbType, int majorVersion, int minorVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIndexes(Connection connection, List<com.liferay.portal.kernel.dao.db.IndexMetadata> indexMetadatas) protected voidaddPrimaryKey(Connection connection, String tableName, String[] columnNames) voidalterColumnName(Connection connection, String tableName, String oldColumnName, String newColumnDefinition) voidalterColumnType(Connection connection, String tableName, String columnName, String newColumnType) voidalterTableAddColumn(Connection connection, String tableName, String columnName, String columnType) voidalterTableDropColumn(Connection connection, String tableName, String columnName) protected String[]buildColumnNameTokens(String line) protected String[]buildColumnTypeTokens(String line) abstract Stringprotected String[]buildTableNameTokens(String line) voidcopyTableRows(Connection connection, String sourceTableName, String targetTableName, Map<String, String> columnNamesMap, Map<String, String> defaultValuesMap) voidcopyTableStructure(Connection connection, String tableName, String newTableName) protected voidcreateSyncDeleteTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames) protected voidcreateSyncInsertTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourceColumnNames, String[] targetColumnNames, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames, Map<String, String> defaultValuesMap) protected voidcreateSyncUpdateTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourceColumnNames, String[] targetColumnNames, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames, Map<String, String> defaultValuesMap) protected voiddoRenameTables(Connection connection, com.liferay.portal.kernel.util.ObjectValuePair<String, String>... tableNameObjectValuePairs) List<com.liferay.portal.kernel.dao.db.IndexMetadata>dropIndexes(Connection connection, String tableName, String columnName) dropIndexes(Connection connection, String indexesSQL, List<com.liferay.portal.kernel.dao.db.Index> indexes) protected voiddropTrigger(Connection connection, String tableName, String triggerName) protected StringgetCopyTableStructureSQL(String tableName, String newTableName) com.liferay.portal.kernel.dao.db.DBTypegetDefaultValue(String columnDef) protected StringgetIndexColumnName(String indexColumnName) List<com.liferay.portal.kernel.dao.db.Index>getIndexes(Connection connection) List<com.liferay.portal.kernel.dao.db.IndexMetadata>getIndexMetadatas(Connection connection, String tableName, String columnName, boolean onlyUnique) getIndexResultSet(Connection connection, String tableName, boolean onlyUnique) intintString[]getPrimaryKeyColumnNames(Connection connection, String tableName) protected StringgetRenameTableSQL(String oldTableName, String newTableName) getSQLType(String templateType) getSQLTypeDecimalDigits(String templateType) protected abstract int[]getSQLTypeSize(String templateType) protected abstract String[]booleanbooleanbooleanprotected booleanprotected booleanbooleanbooleanbooleanbooleanbooleanprotected StringlimitColumnLength(String column, int length) voidvoidremovePrimaryKey(Connection connection, String tableName) voidrenameTables(Connection connection, com.liferay.portal.kernel.util.ObjectValuePair<String, String>... tableNameObjectValuePairs) protected StringreplaceTemplate(String template) protected abstract StringvoidvoidvoidrunSQL(Connection connection, String sql) voidrunSQL(Connection connection, String[] sqls) voidrunSQLTemplate(String template, boolean failOnError) voidrunSQLTemplate(Connection connection, String template, boolean failOnError) voidsetSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery) syncTables(Connection connection, String sourceTableName, String targetTableName, Map<String, String> columnNamesMap, Map<String, String> defaultValuesMap) voidupdateIndexes(Connection connection, String tableName, String indexesSQL, boolean dropIndexes) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.liferay.portal.kernel.dao.db.DB
getNewUuidFunctionName, getPopulateSQL, getRecreateSQL, isSupportsNewUuidFunction, runSQL, runSQL, runSQLTemplateString, runSQLTemplateString
-
Field Details
-
ALTER_COLUMN_NAME
- See Also:
-
ALTER_COLUMN_TYPE
- See Also:
-
ALTER_TABLE_NAME
- See Also:
-
CREATE_TABLE
- See Also:
-
DROP_INDEX
- See Also:
-
DROP_PRIMARY_KEY
- See Also:
-
RENAME_TABLE_TEMPLATE
-
REWORD_TEMPLATE
-
SQL_VARCHAR_TYPES
protected static final int[] SQL_VARCHAR_TYPES -
TEMPLATE
-
columnTypePattern
-
-
Constructor Details
-
BaseDB
protected BaseDB(com.liferay.portal.kernel.dao.db.DBType dbType, int majorVersion, int minorVersion)
-
-
Method Details
-
addIndexes
public void addIndexes(Connection connection, List<com.liferay.portal.kernel.dao.db.IndexMetadata> indexMetadatas) throws IOException, SQLException - Specified by:
addIndexesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
alterColumnName
public void alterColumnName(Connection connection, String tableName, String oldColumnName, String newColumnDefinition) throws Exception - Specified by:
alterColumnNamein interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
alterColumnType
public void alterColumnType(Connection connection, String tableName, String columnName, String newColumnType) throws Exception - Specified by:
alterColumnTypein interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
alterTableAddColumn
public void alterTableAddColumn(Connection connection, String tableName, String columnName, String columnType) throws Exception - Specified by:
alterTableAddColumnin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
alterTableDropColumn
public void alterTableDropColumn(Connection connection, String tableName, String columnName) throws Exception - Specified by:
alterTableDropColumnin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
buildSQL
- Specified by:
buildSQLin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
copyTableRows
public void copyTableRows(Connection connection, String sourceTableName, String targetTableName, Map<String, String> columnNamesMap, Map<String, throws ExceptionString> defaultValuesMap) - Specified by:
copyTableRowsin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
copyTableStructure
public void copyTableStructure(Connection connection, String tableName, String newTableName) throws Exception - Specified by:
copyTableStructurein interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
dropIndexes
public List<com.liferay.portal.kernel.dao.db.IndexMetadata> dropIndexes(Connection connection, String tableName, String columnName) throws IOException, SQLException - Specified by:
dropIndexesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
getDBType
public com.liferay.portal.kernel.dao.db.DBType getDBType()- Specified by:
getDBTypein interfacecom.liferay.portal.kernel.dao.db.DB
-
getDefaultValue
- Specified by:
getDefaultValuein interfacecom.liferay.portal.kernel.dao.db.DB
-
getIndexes
public List<com.liferay.portal.kernel.dao.db.Index> getIndexes(Connection connection) throws SQLException - Specified by:
getIndexesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
SQLException
-
getIndexMetadatas
public List<com.liferay.portal.kernel.dao.db.IndexMetadata> getIndexMetadatas(Connection connection, String tableName, String columnName, boolean onlyUnique) throws SQLException - Specified by:
getIndexMetadatasin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
SQLException
-
getIndexResultSet
public ResultSet getIndexResultSet(Connection connection, String tableName, boolean onlyUnique) throws SQLException - Specified by:
getIndexResultSetin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
SQLException
-
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfacecom.liferay.portal.kernel.dao.db.DB
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfacecom.liferay.portal.kernel.dao.db.DB
-
getPrimaryKeyColumnNames
public String[] getPrimaryKeyColumnNames(Connection connection, String tableName) throws SQLException - Specified by:
getPrimaryKeyColumnNamesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
SQLException
-
getSQLType
- Specified by:
getSQLTypein interfacecom.liferay.portal.kernel.dao.db.DB
-
getSQLTypeDecimalDigits
- Specified by:
getSQLTypeDecimalDigitsin interfacecom.liferay.portal.kernel.dao.db.DB
-
getSQLTypeSize
- Specified by:
getSQLTypeSizein interfacecom.liferay.portal.kernel.dao.db.DB
-
getTemplateBlob
- Specified by:
getTemplateBlobin interfacecom.liferay.portal.kernel.dao.db.DB
-
getTemplateFalse
- Specified by:
getTemplateFalsein interfacecom.liferay.portal.kernel.dao.db.DB
-
getTemplateTrue
- Specified by:
getTemplateTruein interfacecom.liferay.portal.kernel.dao.db.DB
-
getVersionString
- Specified by:
getVersionStringin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsAlterColumnName
public boolean isSupportsAlterColumnName()- Specified by:
isSupportsAlterColumnNamein interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsAlterColumnType
public boolean isSupportsAlterColumnType()- Specified by:
isSupportsAlterColumnTypein interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsDBPartition
public boolean isSupportsDBPartition()- Specified by:
isSupportsDBPartitionin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsInlineDistinct
public boolean isSupportsInlineDistinct()- Specified by:
isSupportsInlineDistinctin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsQueryingAfterException
public boolean isSupportsQueryingAfterException()- Specified by:
isSupportsQueryingAfterExceptionin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsScrollableResults
public boolean isSupportsScrollableResults()- Specified by:
isSupportsScrollableResultsin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsStringCaseSensitiveQuery
public boolean isSupportsStringCaseSensitiveQuery()- Specified by:
isSupportsStringCaseSensitiveQueryin interfacecom.liferay.portal.kernel.dao.db.DB
-
isSupportsUpdateWithInnerJoin
public boolean isSupportsUpdateWithInnerJoin()- Specified by:
isSupportsUpdateWithInnerJoinin interfacecom.liferay.portal.kernel.dao.db.DB
-
process
public void process(com.liferay.petra.function.UnsafeConsumer<Long, Exception> unsafeConsumer) throws Exception- Specified by:
processin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
removePrimaryKey
- Specified by:
removePrimaryKeyin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
renameTables
public void renameTables(Connection connection, com.liferay.portal.kernel.util.ObjectValuePair<String, String>... tableNameObjectValuePairs) throws Exception- Specified by:
renameTablesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
runSQL
- Specified by:
runSQLin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
runSQL
- Specified by:
runSQLin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
runSQL
- Specified by:
runSQLin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
runSQL
- Specified by:
runSQLin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionSQLException
-
runSQLTemplate
public void runSQLTemplate(Connection connection, String template, boolean failOnError) throws IOException, NamingException, SQLException - Specified by:
runSQLTemplatein interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionNamingExceptionSQLException
-
runSQLTemplate
public void runSQLTemplate(String template, boolean failOnError) throws IOException, NamingException, SQLException - Specified by:
runSQLTemplatein interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
IOExceptionNamingExceptionSQLException
-
setSupportsStringCaseSensitiveQuery
public void setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery) - Specified by:
setSupportsStringCaseSensitiveQueryin interfacecom.liferay.portal.kernel.dao.db.DB
-
syncTables
public AutoCloseable syncTables(Connection connection, String sourceTableName, String targetTableName, Map<String, String> columnNamesMap, Map<String, throws ExceptionString> defaultValuesMap) - Specified by:
syncTablesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
updateIndexes
public void updateIndexes(Connection connection, String tableName, String indexesSQL, boolean dropIndexes) throws Exception - Specified by:
updateIndexesin interfacecom.liferay.portal.kernel.dao.db.DB- Throws:
Exception
-
addPrimaryKey
protected void addPrimaryKey(Connection connection, String tableName, String[] columnNames) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
buildColumnNameTokens
-
buildColumnTypeTokens
-
buildTableNameTokens
-
createSyncDeleteTrigger
protected void createSyncDeleteTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames) throws Exception - Throws:
Exception
-
createSyncInsertTrigger
protected void createSyncInsertTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourceColumnNames, String[] targetColumnNames, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames, Map<String, String> defaultValuesMap) throws Exception- Throws:
Exception
-
createSyncUpdateTrigger
protected void createSyncUpdateTrigger(Connection connection, String sourceTableName, String targetTableName, String triggerName, String[] sourceColumnNames, String[] targetColumnNames, String[] sourcePrimaryKeyColumnNames, String[] targetPrimaryKeyColumnNames, Map<String, String> defaultValuesMap) throws Exception- Throws:
Exception
-
doRenameTables
protected void doRenameTables(Connection connection, com.liferay.portal.kernel.util.ObjectValuePair<String, String>... tableNameObjectValuePairs) throws Exception- Throws:
Exception
-
dropIndexes
protected Set<String> dropIndexes(Connection connection, String indexesSQL, List<com.liferay.portal.kernel.dao.db.Index> indexes) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
dropTrigger
protected void dropTrigger(Connection connection, String tableName, String triggerName) throws Exception - Throws:
Exception
-
getCopyTableStructureSQL
-
getIndexColumnName
-
getRenameTableSQL
-
getSQLTypes
protected abstract int[] getSQLTypes() -
getSQLVarcharSizes
-
getTemplate
-
isSupportsDDLRollback
protected boolean isSupportsDDLRollback() -
isSupportsDuplicatedIndexName
protected boolean isSupportsDuplicatedIndexName() -
limitColumnLength
-
replaceTemplate
-
reword
- Throws:
IOExceptionSQLException
-