Liferay 6.0.5

com.liferay.portal.dao.db
Class BaseDB

java.lang.Object
  extended by 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


Field Summary
protected static String ALTER_COLUMN_NAME
           
protected static String ALTER_COLUMN_TYPE
           
protected static String DROP_INDEX
           
protected static String DROP_PRIMARY_KEY
           
protected static String[] REWORD_TEMPLATE
           
protected static String[] TEMPLATE
           
 
Fields inherited from interface com.liferay.portal.kernel.dao.db.DB
MINIMAL, POPULATED, 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
 
Constructor Summary
protected BaseDB(String type)
           
 
Method Summary
protected  void addIndexes(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 buildTemplate(String sqlDir, String fileName)
           
protected  String convertTimestamp(String data)
           
protected  Set<String> dropIndexes(String tablesSQL, String indexesSQL, String indexesProperties, List<Index> indexes)
           
protected  String evaluateVM(String template)
           
 List<Index> getIndexes()
           
protected abstract  String getServerName()
           
protected  String getSuffix(int type)
           
protected abstract  String[] getTemplate()
           
 String getTemplateFalse()
           
 String getTemplateTrue()
           
 String getType()
           
 long increment()
           
 boolean isSupportsAlterColumnName()
           
 boolean isSupportsAlterColumnType()
           
 boolean isSupportsDateMilliseconds()
           
 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(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
 

Field Detail

ALTER_COLUMN_TYPE

protected static String ALTER_COLUMN_TYPE

ALTER_COLUMN_NAME

protected static String ALTER_COLUMN_NAME

DROP_INDEX

protected static String DROP_INDEX

DROP_PRIMARY_KEY

protected static String DROP_PRIMARY_KEY

REWORD_TEMPLATE

protected static String[] REWORD_TEMPLATE

TEMPLATE

protected static String[] TEMPLATE
Constructor Detail

BaseDB

protected BaseDB(String type)
Method Detail

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()
                       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

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

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(String sql)
            throws IOException,
                   SQLException
Specified by:
runSQL in interface DB
Throws:
IOException
SQLException

runSQL

public void runSQL(Connection con,
                   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

runSQL

public void runSQL(Connection con,
                   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(String tablesSQL,
                          String indexesSQL,
                          String indexesProperties,
                          boolean dropIndexes)
                   throws IOException,
                          SQLException
Specified by:
updateIndexes in interface DB
Throws:
IOException
SQLException

addIndexes

protected void addIndexes(String indexesSQL,
                          Set<String> validIndexNames)
                   throws IOException
Throws:
IOException

buildCreateFileContent

protected abstract String buildCreateFileContent(String sqlDir,
                                                 String databaseName,
                                                 int population)
                                          throws IOException
Throws:
IOException

buildColumnNameTokens

protected String[] buildColumnNameTokens(String line)

buildColumnTypeTokens

protected String[] buildColumnTypeTokens(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(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

getServerName

protected abstract String getServerName()

getSuffix

protected String getSuffix(int type)

getTemplate

protected abstract String[] getTemplate()

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 6.0.5