com.liferay.portal.dao.db
Class BaseDB
java.lang.Object
com.liferay.portal.dao.db.BaseDB
- All Implemented Interfaces:
- DB
- Direct Known Subclasses:
- HypersonicDB, MySQLDB, PostgreSQLDB
public abstract class BaseDB
- extends Object
- implements DB
| Fields inherited from interface com.liferay.portal.kernel.dao.db.DB |
BARE, DEFAULT |
|
Constructor Summary |
protected |
BaseDB(DBType dbType,
int majorVersion,
int minorVersion)
|
|
Method Summary |
void |
addIndexes(Connection con,
String indexesSQL,
Set<String> validIndexNames)
|
protected String |
applyMaxStringIndexLengthLimitation(Matcher matcher)
|
protected String[] |
buildColumnNameTokens(String line)
|
protected String[] |
buildColumnTypeTokens(String line)
|
void |
buildCreateFile(String sqlDir,
String databaseName)
|
void |
buildCreateFile(String sqlDir,
String databaseName,
int population)
|
protected abstract String |
buildCreateFileContent(String sqlDir,
String databaseName,
int population)
|
abstract String |
buildSQL(String template)
|
void |
buildSQLFile(String sqlDir,
String fileName)
|
protected String[] |
buildTableNameTokens(String line)
|
protected String |
buildTemplate(String sqlDir,
String fileName)
|
protected String |
convertTimestamp(String data)
|
protected Set<String> |
dropIndexes(Connection con,
String tablesSQL,
String indexesSQL,
List<Index> indexes)
|
protected String |
evaluateVM(String templateId,
String templateContent)
|
protected String |
getCreateTablesContent(String sqlDir,
String suffix)
|
DBType |
getDBType()
|
List<Index> |
getIndexes(Connection con)
|
int |
getMajorVersion()
|
int |
getMinorVersion()
|
protected abstract String |
getServerName()
|
protected String |
getSuffix(int type)
|
protected abstract String[] |
getTemplate()
|
String |
getTemplateFalse()
|
String |
getTemplateTrue()
|
String |
getVersionString()
|
protected void |
handleSQLException(String sql,
SQLException sqle)
|
long |
increment()
|
long |
increment(String name)
|
boolean |
isSupportsAlterColumnName()
|
boolean |
isSupportsAlterColumnType()
|
boolean |
isSupportsInlineDistinct()
|
boolean |
isSupportsQueryingAfterException()
|
boolean |
isSupportsScrollableResults()
|
boolean |
isSupportsStringCaseSensitiveQuery()
|
boolean |
isSupportsUpdateWithInnerJoin()
|
protected String |
readFile(String fileName)
|
protected String |
readSQL(String fileName,
String comments,
String eol)
|
protected String |
removeBooleanIndexes(String sqlDir,
String data)
|
protected String |
removeInserts(String data)
|
protected String |
removeLongInserts(String data)
|
protected String |
removeNull(String content)
|
protected String |
replaceTemplate(String template,
String[] actual)
|
protected abstract String |
reword(String data)
|
void |
runSQL(Connection con,
String sql)
|
void |
runSQL(Connection con,
String[] sqls)
|
void |
runSQL(String sql)
|
void |
runSQL(String[] sqls)
|
void |
runSQLTemplate(String path)
|
void |
runSQLTemplate(String path,
boolean failOnError)
|
void |
runSQLTemplateString(Connection connection,
String template,
boolean evaluate,
boolean failOnError)
|
void |
runSQLTemplateString(String template,
boolean evaluate,
boolean failOnError)
|
void |
setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
|
void |
updateIndexes(Connection con,
String tablesSQL,
String indexesSQL,
boolean dropIndexes)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ALTER_COLUMN_NAME
protected static final String ALTER_COLUMN_NAME
- See Also:
- Constant Field Values
ALTER_COLUMN_TYPE
protected static final String ALTER_COLUMN_TYPE
- See Also:
- Constant Field Values
ALTER_TABLE_NAME
protected static final String ALTER_TABLE_NAME
- See Also:
- Constant Field Values
DROP_INDEX
protected static final String DROP_INDEX
- See Also:
- Constant Field Values
DROP_PRIMARY_KEY
protected static final String DROP_PRIMARY_KEY
- See Also:
- Constant Field Values
RENAME_TABLE_TEMPLATE
protected static final String[] RENAME_TABLE_TEMPLATE
REWORD_TEMPLATE
protected static final String[] REWORD_TEMPLATE
TEMPLATE
protected static final String[] TEMPLATE
BaseDB
protected BaseDB(DBType dbType,
int majorVersion,
int minorVersion)
addIndexes
public void addIndexes(Connection con,
String indexesSQL,
Set<String> validIndexNames)
throws IOException
- Specified by:
addIndexes in interface DB
- Throws:
IOException
buildCreateFile
public void buildCreateFile(String sqlDir,
String databaseName)
throws IOException
- Specified by:
buildCreateFile in interface DB
- Throws:
IOException
buildCreateFile
public void buildCreateFile(String sqlDir,
String databaseName,
int population)
throws IOException
- Specified by:
buildCreateFile in interface DB
- Throws:
IOException
buildSQL
public abstract String buildSQL(String template)
throws IOException
- Specified by:
buildSQL in interface DB
- Throws:
IOException
buildSQLFile
public void buildSQLFile(String sqlDir,
String fileName)
throws IOException
- Specified by:
buildSQLFile in interface DB
- Throws:
IOException
getDBType
public DBType getDBType()
- Specified by:
getDBType in interface DB
getIndexes
public List<Index> getIndexes(Connection con)
throws SQLException
- Specified by:
getIndexes in interface DB
- Throws:
SQLException
getMajorVersion
public int getMajorVersion()
- Specified by:
getMajorVersion in interface DB
getMinorVersion
public int getMinorVersion()
- Specified by:
getMinorVersion in interface DB
getTemplateFalse
public String getTemplateFalse()
- Specified by:
getTemplateFalse in interface DB
getTemplateTrue
public String getTemplateTrue()
- Specified by:
getTemplateTrue in interface DB
getVersionString
public String getVersionString()
- Specified by:
getVersionString in interface DB
increment
public long increment()
- Specified by:
increment in interface DB
increment
public long increment(String name)
- Specified by:
increment in interface DB
isSupportsAlterColumnName
public boolean isSupportsAlterColumnName()
- Specified by:
isSupportsAlterColumnName in interface DB
isSupportsAlterColumnType
public boolean isSupportsAlterColumnType()
- Specified by:
isSupportsAlterColumnType in interface DB
isSupportsInlineDistinct
public boolean isSupportsInlineDistinct()
- Specified by:
isSupportsInlineDistinct in interface DB
isSupportsQueryingAfterException
public boolean isSupportsQueryingAfterException()
- Specified by:
isSupportsQueryingAfterException in interface DB
isSupportsScrollableResults
public boolean isSupportsScrollableResults()
- Specified by:
isSupportsScrollableResults in interface DB
isSupportsStringCaseSensitiveQuery
public boolean isSupportsStringCaseSensitiveQuery()
- Specified by:
isSupportsStringCaseSensitiveQuery in interface DB
isSupportsUpdateWithInnerJoin
public boolean isSupportsUpdateWithInnerJoin()
- Specified by:
isSupportsUpdateWithInnerJoin in interface DB
runSQL
public void runSQL(Connection con,
String sql)
throws IOException,
SQLException
- Specified by:
runSQL in interface DB
- Throws:
IOException
SQLException
runSQL
public void runSQL(Connection con,
String[] sqls)
throws IOException,
SQLException
- Specified by:
runSQL in interface DB
- Throws:
IOException
SQLException
runSQL
public void runSQL(String sql)
throws IOException,
SQLException
- Specified by:
runSQL in interface DB
- Throws:
IOException
SQLException
runSQL
public void runSQL(String[] sqls)
throws IOException,
SQLException
- Specified by:
runSQL in interface DB
- Throws:
IOException
SQLException
runSQLTemplate
public void runSQLTemplate(String path)
throws IOException,
NamingException,
SQLException
- Specified by:
runSQLTemplate in interface DB
- Throws:
IOException
NamingException
SQLException
runSQLTemplate
public void runSQLTemplate(String path,
boolean failOnError)
throws IOException,
NamingException,
SQLException
- Specified by:
runSQLTemplate in interface DB
- Throws:
IOException
NamingException
SQLException
runSQLTemplateString
public void runSQLTemplateString(Connection connection,
String template,
boolean evaluate,
boolean failOnError)
throws IOException,
NamingException,
SQLException
- Specified by:
runSQLTemplateString in interface DB
- Throws:
IOException
NamingException
SQLException
runSQLTemplateString
public void runSQLTemplateString(String template,
boolean evaluate,
boolean failOnError)
throws IOException,
NamingException,
SQLException
- Specified by:
runSQLTemplateString in interface DB
- Throws:
IOException
NamingException
SQLException
setSupportsStringCaseSensitiveQuery
public void setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
- Specified by:
setSupportsStringCaseSensitiveQuery in interface DB
updateIndexes
public void updateIndexes(Connection con,
String tablesSQL,
String indexesSQL,
boolean dropIndexes)
throws IOException,
SQLException
- Specified by:
updateIndexes in interface DB
- Throws:
IOException
SQLException
applyMaxStringIndexLengthLimitation
protected String applyMaxStringIndexLengthLimitation(Matcher matcher)
buildColumnNameTokens
protected String[] buildColumnNameTokens(String line)
buildColumnTypeTokens
protected String[] buildColumnTypeTokens(String line)
buildCreateFileContent
protected abstract String buildCreateFileContent(String sqlDir,
String databaseName,
int population)
throws IOException
- Throws:
IOException
buildTableNameTokens
protected String[] buildTableNameTokens(String line)
buildTemplate
protected String buildTemplate(String sqlDir,
String fileName)
throws IOException
- Throws:
IOException
convertTimestamp
protected String convertTimestamp(String data)
dropIndexes
protected Set<String> dropIndexes(Connection con,
String tablesSQL,
String indexesSQL,
List<Index> indexes)
throws IOException,
SQLException
- Throws:
IOException
SQLException
evaluateVM
protected String evaluateVM(String templateId,
String templateContent)
throws Exception
- Throws:
Exception
getCreateTablesContent
protected String getCreateTablesContent(String sqlDir,
String suffix)
throws IOException
- Throws:
IOException
getServerName
protected abstract String getServerName()
getSuffix
protected String getSuffix(int type)
getTemplate
protected abstract String[] getTemplate()
handleSQLException
protected void handleSQLException(String sql,
SQLException sqle)
throws SQLException
- Throws:
SQLException
readFile
protected String readFile(String fileName)
throws IOException
- Throws:
IOException
readSQL
protected String readSQL(String fileName,
String comments,
String eol)
throws IOException
- Throws:
IOException
removeBooleanIndexes
protected String removeBooleanIndexes(String sqlDir,
String data)
throws IOException
- Throws:
IOException
removeInserts
protected String removeInserts(String data)
throws IOException
- Throws:
IOException
removeLongInserts
protected String removeLongInserts(String data)
throws IOException
- Throws:
IOException
removeNull
protected String removeNull(String content)
replaceTemplate
protected String replaceTemplate(String template,
String[] actual)
reword
protected abstract String reword(String data)
throws IOException
- Throws:
IOException