Liferay 7.0-ga1 portal-impl

com.liferay.portal.dao.db
Class BaseDB

java.lang.Object
  extended by com.liferay.portal.dao.db.BaseDB
All Implemented Interfaces:
com.liferay.portal.kernel.dao.db.DB
Direct Known Subclasses:
HypersonicDB, MySQLDB, PostgreSQLDB

public abstract class BaseDB
extends Object
implements com.liferay.portal.kernel.dao.db.DB


Field Summary
protected static String ALTER_COLUMN_NAME
           
protected static String ALTER_COLUMN_TYPE
           
protected static String ALTER_TABLE_NAME
           
protected static String CREATE_TABLE
           
protected static String DROP_INDEX
           
protected static String DROP_PRIMARY_KEY
           
protected static String[] RENAME_TABLE_TEMPLATE
           
protected static String[] REWORD_TEMPLATE
           
protected static String[] TEMPLATE
           
 
Fields inherited from interface com.liferay.portal.kernel.dao.db.DB
BARE, DEFAULT
 
Constructor Summary
protected BaseDB(com.liferay.portal.kernel.dao.db.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<com.liferay.portal.kernel.dao.db.Index> indexes)
           
protected  String evaluateVM(String templateId, String templateContent)
           
protected  String getCreateTablesContent(String sqlDir, String suffix)
           
 com.liferay.portal.kernel.dao.db.DBType getDBType()
           
 List<com.liferay.portal.kernel.dao.db.Index> getIndexes(Connection con)
           
 int getMajorVersion()
           
 int getMinorVersion()
           
protected abstract  String getServerName()
           
protected  String getSuffix(int type)
           
protected abstract  String[] getTemplate()
           
 String getTemplateBlob()
           
 String getTemplateFalse()
           
 String getTemplateTrue()
           
 String getVersionString()
           
protected  void handleSQLException(String sql, SQLException sqle)
           
 long increment()
           
 long increment(String name)
           
 long increment(String name, int size)
           
 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
 

Field Detail

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

CREATE_TABLE

protected static final String CREATE_TABLE
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
Constructor Detail

BaseDB

protected BaseDB(com.liferay.portal.kernel.dao.db.DBType dbType,
                 int majorVersion,
                 int minorVersion)
Method Detail

addIndexes

public void addIndexes(Connection con,
                       String indexesSQL,
                       Set<String> validIndexNames)
                throws IOException
Specified by:
addIndexes in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException

buildCreateFile

public void buildCreateFile(String sqlDir,
                            String databaseName)
                     throws IOException
Specified by:
buildCreateFile in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException

buildCreateFile

public void buildCreateFile(String sqlDir,
                            String databaseName,
                            int population)
                     throws IOException
Specified by:
buildCreateFile in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException

buildSQL

public abstract String buildSQL(String template)
                         throws IOException
Specified by:
buildSQL in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException

buildSQLFile

public void buildSQLFile(String sqlDir,
                         String fileName)
                  throws IOException
Specified by:
buildSQLFile in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException

getDBType

public com.liferay.portal.kernel.dao.db.DBType getDBType()
Specified by:
getDBType in interface com.liferay.portal.kernel.dao.db.DB

getIndexes

public List<com.liferay.portal.kernel.dao.db.Index> getIndexes(Connection con)
                                                        throws SQLException
Specified by:
getIndexes in interface com.liferay.portal.kernel.dao.db.DB
Throws:
SQLException

getMajorVersion

public int getMajorVersion()
Specified by:
getMajorVersion in interface com.liferay.portal.kernel.dao.db.DB

getMinorVersion

public int getMinorVersion()
Specified by:
getMinorVersion in interface com.liferay.portal.kernel.dao.db.DB

getTemplateBlob

public String getTemplateBlob()
Specified by:
getTemplateBlob in interface com.liferay.portal.kernel.dao.db.DB

getTemplateFalse

public String getTemplateFalse()
Specified by:
getTemplateFalse in interface com.liferay.portal.kernel.dao.db.DB

getTemplateTrue

public String getTemplateTrue()
Specified by:
getTemplateTrue in interface com.liferay.portal.kernel.dao.db.DB

getVersionString

public String getVersionString()
Specified by:
getVersionString in interface com.liferay.portal.kernel.dao.db.DB

increment

public long increment()
Specified by:
increment in interface com.liferay.portal.kernel.dao.db.DB

increment

public long increment(String name)
Specified by:
increment in interface com.liferay.portal.kernel.dao.db.DB

increment

public long increment(String name,
                      int size)
Specified by:
increment in interface com.liferay.portal.kernel.dao.db.DB

isSupportsAlterColumnName

public boolean isSupportsAlterColumnName()
Specified by:
isSupportsAlterColumnName in interface com.liferay.portal.kernel.dao.db.DB

isSupportsAlterColumnType

public boolean isSupportsAlterColumnType()
Specified by:
isSupportsAlterColumnType in interface com.liferay.portal.kernel.dao.db.DB

isSupportsInlineDistinct

public boolean isSupportsInlineDistinct()
Specified by:
isSupportsInlineDistinct in interface com.liferay.portal.kernel.dao.db.DB

isSupportsQueryingAfterException

public boolean isSupportsQueryingAfterException()
Specified by:
isSupportsQueryingAfterException in interface com.liferay.portal.kernel.dao.db.DB

isSupportsScrollableResults

public boolean isSupportsScrollableResults()
Specified by:
isSupportsScrollableResults in interface com.liferay.portal.kernel.dao.db.DB

isSupportsStringCaseSensitiveQuery

public boolean isSupportsStringCaseSensitiveQuery()
Specified by:
isSupportsStringCaseSensitiveQuery in interface com.liferay.portal.kernel.dao.db.DB

isSupportsUpdateWithInnerJoin

public boolean isSupportsUpdateWithInnerJoin()
Specified by:
isSupportsUpdateWithInnerJoin in interface com.liferay.portal.kernel.dao.db.DB

runSQL

public void runSQL(Connection con,
                   String sql)
            throws IOException,
                   SQLException
Specified by:
runSQL in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
SQLException

runSQL

public void runSQL(Connection con,
                   String[] sqls)
            throws IOException,
                   SQLException
Specified by:
runSQL in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
SQLException

runSQL

public void runSQL(String sql)
            throws IOException,
                   SQLException
Specified by:
runSQL in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
SQLException

runSQL

public void runSQL(String[] sqls)
            throws IOException,
                   SQLException
Specified by:
runSQL in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
SQLException

runSQLTemplate

public void runSQLTemplate(String path)
                    throws IOException,
                           NamingException,
                           SQLException
Specified by:
runSQLTemplate in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
NamingException
SQLException

runSQLTemplate

public void runSQLTemplate(String path,
                           boolean failOnError)
                    throws IOException,
                           NamingException,
                           SQLException
Specified by:
runSQLTemplate in interface com.liferay.portal.kernel.dao.db.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 com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
NamingException
SQLException

runSQLTemplateString

public void runSQLTemplateString(String template,
                                 boolean evaluate,
                                 boolean failOnError)
                          throws IOException,
                                 NamingException,
                                 SQLException
Specified by:
runSQLTemplateString in interface com.liferay.portal.kernel.dao.db.DB
Throws:
IOException
NamingException
SQLException

setSupportsStringCaseSensitiveQuery

public void setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
Specified by:
setSupportsStringCaseSensitiveQuery in interface com.liferay.portal.kernel.dao.db.DB

updateIndexes

public void updateIndexes(Connection con,
                          String tablesSQL,
                          String indexesSQL,
                          boolean dropIndexes)
                   throws IOException,
                          SQLException
Specified by:
updateIndexes in interface com.liferay.portal.kernel.dao.db.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<com.liferay.portal.kernel.dao.db.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

Liferay 7.0-ga1 portal-impl