public abstract class BaseDB
extends java.lang.Object
implements com.liferay.portal.kernel.dao.db.DB
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
ALTER_COLUMN_NAME |
protected static java.lang.String |
ALTER_COLUMN_TYPE |
protected static java.lang.String |
ALTER_TABLE_NAME |
protected static java.util.regex.Pattern |
columnTypePattern |
protected static java.lang.String |
CREATE_TABLE |
protected static java.lang.String |
DROP_INDEX |
protected static java.lang.String |
DROP_PRIMARY_KEY |
protected static java.lang.String[] |
RENAME_TABLE_TEMPLATE |
protected static java.lang.String[] |
REWORD_TEMPLATE |
protected static int[] |
SQL_VARCHAR_TYPES |
protected static java.lang.String[] |
TEMPLATE |
| Modifier | Constructor and Description |
|---|---|
protected |
BaseDB(com.liferay.portal.kernel.dao.db.DBType dbType,
int majorVersion,
int minorVersion) |
| Modifier and Type | Method and Description |
|---|---|
void |
addIndexes(java.sql.Connection connection,
java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> indexMetadatas) |
protected void |
addPrimaryKey(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String[] columnNames) |
void |
alterColumnName(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String oldColumnName,
java.lang.String newColumnDefinition) |
void |
alterColumnType(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String newColumnType) |
void |
alterTableAddColumn(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String columnType) |
void |
alterTableDropColumn(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName) |
protected java.lang.String[] |
buildColumnNameTokens(java.lang.String line) |
protected java.lang.String[] |
buildColumnTypeTokens(java.lang.String line) |
abstract java.lang.String |
buildSQL(java.lang.String template) |
protected java.lang.String[] |
buildTableNameTokens(java.lang.String line) |
void |
copyTableRows(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.util.Map<java.lang.String,java.lang.String> columnNamesMap,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap) |
void |
copyTableStructure(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String newTableName) |
protected void |
createSyncDeleteTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames) |
protected void |
createSyncInsertTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourceColumnNames,
java.lang.String[] targetColumnNames,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap) |
protected void |
createSyncUpdateTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourceColumnNames,
java.lang.String[] targetColumnNames,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap) |
protected void |
doRenameTables(java.sql.Connection connection,
com.liferay.portal.kernel.util.ObjectValuePair<java.lang.String,java.lang.String>... tableNameObjectValuePairs) |
java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> |
dropIndexes(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName) |
protected java.util.Set<java.lang.String> |
dropIndexes(java.sql.Connection connection,
java.lang.String tablesSQL,
java.lang.String indexesSQL,
java.util.List<com.liferay.portal.kernel.dao.db.Index> indexes) |
protected void |
dropTrigger(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String triggerName) |
protected java.lang.String |
getCopyTableStructureSQL(java.lang.String tableName,
java.lang.String newTableName) |
com.liferay.portal.kernel.dao.db.DBType |
getDBType() |
java.lang.String |
getDefaultValue(java.lang.String columnDef) |
java.util.List<com.liferay.portal.kernel.dao.db.Index> |
getIndexes(java.sql.Connection connection) |
protected java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> |
getIndexes(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
boolean onlyUnique) |
java.sql.ResultSet |
getIndexResultSet(java.sql.Connection connection,
java.lang.String tableName) |
int |
getMajorVersion() |
int |
getMinorVersion() |
java.lang.String[] |
getPrimaryKeyColumnNames(java.sql.Connection connection,
java.lang.String tableName) |
protected java.lang.String |
getRenameTableSQL(java.lang.String oldTableName,
java.lang.String newTableName) |
java.lang.Integer |
getSQLType(java.lang.String templateType) |
java.lang.Integer |
getSQLTypeDecimalDigits(java.lang.String templateType) |
protected abstract int[] |
getSQLTypes() |
java.lang.Integer |
getSQLTypeSize(java.lang.String templateType) |
protected java.util.Map<java.lang.String,java.lang.Integer> |
getSQLVarcharSizes() |
protected abstract java.lang.String[] |
getTemplate() |
java.lang.String |
getTemplateBlob() |
java.lang.String |
getTemplateFalse() |
java.lang.String |
getTemplateTrue() |
java.lang.String |
getVersionString() |
boolean |
isSupportsAlterColumnName() |
boolean |
isSupportsAlterColumnType() |
protected boolean |
isSupportsDDLRollback() |
protected boolean |
isSupportsDuplicatedIndexName() |
boolean |
isSupportsInlineDistinct() |
boolean |
isSupportsQueryingAfterException() |
boolean |
isSupportsScrollableResults() |
boolean |
isSupportsStringCaseSensitiveQuery() |
boolean |
isSupportsUpdateWithInnerJoin() |
protected java.lang.String |
limitColumnLength(java.lang.String column,
int length) |
void |
process(com.liferay.petra.function.UnsafeConsumer<java.lang.Long,java.lang.Exception> unsafeConsumer) |
void |
removePrimaryKey(java.sql.Connection connection,
java.lang.String tableName) |
void |
renameTables(java.sql.Connection connection,
com.liferay.portal.kernel.util.ObjectValuePair<java.lang.String,java.lang.String>... tableNameObjectValuePairs) |
protected java.lang.String |
replaceTemplate(java.lang.String template) |
protected abstract java.lang.String |
reword(java.lang.String data) |
void |
runSQL(java.sql.Connection connection,
java.lang.String sql) |
void |
runSQL(java.sql.Connection connection,
java.lang.String[] sqls) |
void |
runSQL(java.lang.String sql) |
void |
runSQL(java.lang.String[] sqls) |
void |
runSQLTemplateString(java.sql.Connection connection,
java.lang.String template,
boolean failOnError) |
void |
runSQLTemplateString(java.lang.String template,
boolean failOnError) |
void |
setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery) |
java.lang.AutoCloseable |
syncTables(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.util.Map<java.lang.String,java.lang.String> columnNamesMap,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap) |
void |
updateIndexes(java.sql.Connection connection,
java.lang.String tablesSQL,
java.lang.String indexesSQL,
boolean dropIndexes) |
protected static final java.lang.String ALTER_COLUMN_NAME
protected static final java.lang.String ALTER_COLUMN_TYPE
protected static final java.lang.String ALTER_TABLE_NAME
protected static final java.lang.String CREATE_TABLE
protected static final java.lang.String DROP_INDEX
protected static final java.lang.String DROP_PRIMARY_KEY
protected static final java.lang.String[] RENAME_TABLE_TEMPLATE
protected static final java.lang.String[] REWORD_TEMPLATE
protected static final int[] SQL_VARCHAR_TYPES
protected static final java.lang.String[] TEMPLATE
protected static final java.util.regex.Pattern columnTypePattern
protected BaseDB(com.liferay.portal.kernel.dao.db.DBType dbType,
int majorVersion,
int minorVersion)
public void addIndexes(java.sql.Connection connection,
java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> indexMetadatas)
throws java.io.IOException,
java.sql.SQLException
addIndexes in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void alterColumnName(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String oldColumnName,
java.lang.String newColumnDefinition)
throws java.lang.Exception
alterColumnName in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void alterColumnType(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String newColumnType)
throws java.lang.Exception
alterColumnType in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void alterTableAddColumn(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
java.lang.String columnType)
throws java.lang.Exception
alterTableAddColumn in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void alterTableDropColumn(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName)
throws java.lang.Exception
alterTableDropColumn in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic abstract java.lang.String buildSQL(java.lang.String template)
throws java.io.IOException,
java.sql.SQLException
buildSQL in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void copyTableRows(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.util.Map<java.lang.String,java.lang.String> columnNamesMap,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap)
throws java.lang.Exception
copyTableRows in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void copyTableStructure(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String newTableName)
throws java.lang.Exception
copyTableStructure in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> dropIndexes(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName)
throws java.io.IOException,
java.sql.SQLException
dropIndexes in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic com.liferay.portal.kernel.dao.db.DBType getDBType()
getDBType in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String getDefaultValue(java.lang.String columnDef)
getDefaultValue in interface com.liferay.portal.kernel.dao.db.DBpublic java.util.List<com.liferay.portal.kernel.dao.db.Index> getIndexes(java.sql.Connection connection)
throws java.sql.SQLException
getIndexes in interface com.liferay.portal.kernel.dao.db.DBjava.sql.SQLExceptionpublic java.sql.ResultSet getIndexResultSet(java.sql.Connection connection,
java.lang.String tableName)
throws java.sql.SQLException
getIndexResultSet in interface com.liferay.portal.kernel.dao.db.DBjava.sql.SQLExceptionpublic int getMajorVersion()
getMajorVersion in interface com.liferay.portal.kernel.dao.db.DBpublic int getMinorVersion()
getMinorVersion in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String[] getPrimaryKeyColumnNames(java.sql.Connection connection,
java.lang.String tableName)
throws java.sql.SQLException
getPrimaryKeyColumnNames in interface com.liferay.portal.kernel.dao.db.DBjava.sql.SQLExceptionpublic java.lang.Integer getSQLType(java.lang.String templateType)
getSQLType in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.Integer getSQLTypeDecimalDigits(java.lang.String templateType)
getSQLTypeDecimalDigits in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.Integer getSQLTypeSize(java.lang.String templateType)
getSQLTypeSize in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String getTemplateBlob()
getTemplateBlob in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String getTemplateFalse()
getTemplateFalse in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String getTemplateTrue()
getTemplateTrue in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.String getVersionString()
getVersionString in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsAlterColumnName()
isSupportsAlterColumnName in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsAlterColumnType()
isSupportsAlterColumnType in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsInlineDistinct()
isSupportsInlineDistinct in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsQueryingAfterException()
isSupportsQueryingAfterException in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsScrollableResults()
isSupportsScrollableResults in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsStringCaseSensitiveQuery()
isSupportsStringCaseSensitiveQuery in interface com.liferay.portal.kernel.dao.db.DBpublic boolean isSupportsUpdateWithInnerJoin()
isSupportsUpdateWithInnerJoin in interface com.liferay.portal.kernel.dao.db.DBpublic void process(com.liferay.petra.function.UnsafeConsumer<java.lang.Long,java.lang.Exception> unsafeConsumer)
throws java.lang.Exception
process in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void removePrimaryKey(java.sql.Connection connection,
java.lang.String tableName)
throws java.lang.Exception
removePrimaryKey in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void renameTables(java.sql.Connection connection,
com.liferay.portal.kernel.util.ObjectValuePair<java.lang.String,java.lang.String>... tableNameObjectValuePairs)
throws java.lang.Exception
renameTables in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void runSQL(java.sql.Connection connection,
java.lang.String sql)
throws java.io.IOException,
java.sql.SQLException
runSQL in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void runSQL(java.sql.Connection connection,
java.lang.String[] sqls)
throws java.io.IOException,
java.sql.SQLException
runSQL in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void runSQL(java.lang.String sql)
throws java.io.IOException,
java.sql.SQLException
runSQL in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void runSQL(java.lang.String[] sqls)
throws java.io.IOException,
java.sql.SQLException
runSQL in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjava.sql.SQLExceptionpublic void runSQLTemplateString(java.sql.Connection connection,
java.lang.String template,
boolean failOnError)
throws java.io.IOException,
javax.naming.NamingException,
java.sql.SQLException
runSQLTemplateString in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjavax.naming.NamingExceptionjava.sql.SQLExceptionpublic void runSQLTemplateString(java.lang.String template,
boolean failOnError)
throws java.io.IOException,
javax.naming.NamingException,
java.sql.SQLException
runSQLTemplateString in interface com.liferay.portal.kernel.dao.db.DBjava.io.IOExceptionjavax.naming.NamingExceptionjava.sql.SQLExceptionpublic void setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
setSupportsStringCaseSensitiveQuery in interface com.liferay.portal.kernel.dao.db.DBpublic java.lang.AutoCloseable syncTables(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.util.Map<java.lang.String,java.lang.String> columnNamesMap,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap)
throws java.lang.Exception
syncTables in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionpublic void updateIndexes(java.sql.Connection connection,
java.lang.String tablesSQL,
java.lang.String indexesSQL,
boolean dropIndexes)
throws java.lang.Exception
updateIndexes in interface com.liferay.portal.kernel.dao.db.DBjava.lang.Exceptionprotected void addPrimaryKey(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String[] columnNames)
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionprotected java.lang.String[] buildColumnNameTokens(java.lang.String line)
protected java.lang.String[] buildColumnTypeTokens(java.lang.String line)
protected java.lang.String[] buildTableNameTokens(java.lang.String line)
protected void createSyncDeleteTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames)
throws java.lang.Exception
java.lang.Exceptionprotected void createSyncInsertTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourceColumnNames,
java.lang.String[] targetColumnNames,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap)
throws java.lang.Exception
java.lang.Exceptionprotected void createSyncUpdateTrigger(java.sql.Connection connection,
java.lang.String sourceTableName,
java.lang.String targetTableName,
java.lang.String triggerName,
java.lang.String[] sourceColumnNames,
java.lang.String[] targetColumnNames,
java.lang.String[] sourcePrimaryKeyColumnNames,
java.lang.String[] targetPrimaryKeyColumnNames,
java.util.Map<java.lang.String,java.lang.String> defaultValuesMap)
throws java.lang.Exception
java.lang.Exceptionprotected void doRenameTables(java.sql.Connection connection,
com.liferay.portal.kernel.util.ObjectValuePair<java.lang.String,java.lang.String>... tableNameObjectValuePairs)
throws java.lang.Exception
java.lang.Exceptionprotected java.util.Set<java.lang.String> dropIndexes(java.sql.Connection connection,
java.lang.String tablesSQL,
java.lang.String indexesSQL,
java.util.List<com.liferay.portal.kernel.dao.db.Index> indexes)
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLExceptionprotected void dropTrigger(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String triggerName)
throws java.lang.Exception
java.lang.Exceptionprotected java.lang.String getCopyTableStructureSQL(java.lang.String tableName,
java.lang.String newTableName)
protected java.util.List<com.liferay.portal.kernel.dao.db.IndexMetadata> getIndexes(java.sql.Connection connection,
java.lang.String tableName,
java.lang.String columnName,
boolean onlyUnique)
throws java.sql.SQLException
java.sql.SQLExceptionprotected java.lang.String getRenameTableSQL(java.lang.String oldTableName,
java.lang.String newTableName)
protected abstract int[] getSQLTypes()
protected java.util.Map<java.lang.String,java.lang.Integer> getSQLVarcharSizes()
protected abstract java.lang.String[] getTemplate()
protected boolean isSupportsDDLRollback()
protected boolean isSupportsDuplicatedIndexName()
protected java.lang.String limitColumnLength(java.lang.String column,
int length)
protected java.lang.String replaceTemplate(java.lang.String template)
protected abstract java.lang.String reword(java.lang.String data)
throws java.io.IOException,
java.sql.SQLException
java.io.IOExceptionjava.sql.SQLException