com.liferay.portal.dao.db
Class BaseDB
java.lang.Object
com.liferay.portal.dao.db.BaseDB
- All Implemented Interfaces:
- DB
- Direct Known Subclasses:
- DB2DB, DerbyDB, FirebirdDB, HypersonicDB, InformixDB, IngresDB, MySQLDB, OracleDB, PostgreSQLDB, SAPDB, SQLServerDB, SybaseDB
public abstract class BaseDB
- extends Object
- implements DB
Fields inherited from interface com.liferay.portal.kernel.dao.db.DB |
BARE, DEFAULT, SHARDED, TYPE_ALL, TYPE_DB2, TYPE_DERBY, TYPE_FIREBIRD, TYPE_HYPERSONIC, TYPE_INFORMIX, TYPE_INGRES, TYPE_INTERBASE, TYPE_JDATASTORE, TYPE_MYSQL, TYPE_ORACLE, TYPE_POSTGRESQL, TYPE_SAP, TYPE_SQLSERVER, TYPE_SYBASE |
Method Summary |
void |
addIndexes(Connection con,
String indexesSQL,
Set<String> validIndexNames)
|
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,
String indexesProperties,
List<Index> indexes)
|
protected String |
evaluateVM(String template)
|
protected String |
getCreateTablesContent(String sqlDir,
String suffix)
|
List<Index> |
getIndexes(Connection con)
|
protected abstract String |
getServerName()
|
protected String |
getSuffix(int type)
|
protected abstract String[] |
getTemplate()
|
String |
getTemplateFalse()
|
String |
getTemplateTrue()
|
String |
getType()
|
protected void |
handleSQLException(String sql,
SQLException sqle)
|
long |
increment()
|
long |
increment(String name)
|
boolean |
isSupportsAlterColumnName()
|
boolean |
isSupportsAlterColumnType()
|
boolean |
isSupportsDateMilliseconds()
|
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(String template,
boolean evaluate,
boolean failOnError)
|
void |
setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
|
void |
updateIndexes(Connection con,
String tablesSQL,
String indexesSQL,
String indexesProperties,
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(String type)
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
getIndexes
public List<Index> getIndexes(Connection con)
throws SQLException
- Specified by:
getIndexes
in interface DB
- Throws:
SQLException
getTemplateFalse
public String getTemplateFalse()
- Specified by:
getTemplateFalse
in interface DB
getTemplateTrue
public String getTemplateTrue()
- Specified by:
getTemplateTrue
in interface DB
getType
public String getType()
- Specified by:
getType
in interface DB
increment
public long increment()
throws SystemException
- Specified by:
increment
in interface DB
- Throws:
SystemException
increment
public long increment(String name)
throws SystemException
- Specified by:
increment
in interface DB
- Throws:
SystemException
isSupportsAlterColumnName
public boolean isSupportsAlterColumnName()
- Specified by:
isSupportsAlterColumnName
in interface DB
isSupportsAlterColumnType
public boolean isSupportsAlterColumnType()
- Specified by:
isSupportsAlterColumnType
in interface DB
isSupportsDateMilliseconds
public boolean isSupportsDateMilliseconds()
- Specified by:
isSupportsDateMilliseconds
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(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,
String indexesProperties,
boolean dropIndexes)
throws IOException,
SQLException
- Specified by:
updateIndexes
in interface DB
- Throws:
IOException
SQLException
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,
String indexesProperties,
List<Index> indexes)
throws IOException,
SQLException
- Throws:
IOException
SQLException
evaluateVM
protected String evaluateVM(String template)
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