com.liferay.portal.tools.sql
Class DBUtil
java.lang.Object
com.liferay.portal.tools.sql.DBUtil
- Direct Known Subclasses:
- DB2Util, DerbyUtil, FirebirdUtil, HypersonicUtil, InformixUtil, IngresUtil, MySQLUtil, OracleUtil, PostgreSQLUtil, SAPUtil, SQLServerUtil, SybaseUtil
public abstract class DBUtil
- extends java.lang.Object
View Source
- Author:
- Alexander Chow, Ganesh Ram
Constructor Summary |
protected |
DBUtil(java.lang.String type)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TYPE_DB2
public static final java.lang.String TYPE_DB2
- See Also:
- Constant Field Values
TYPE_DERBY
public static final java.lang.String TYPE_DERBY
- See Also:
- Constant Field Values
TYPE_FIREBIRD
public static final java.lang.String TYPE_FIREBIRD
- See Also:
- Constant Field Values
TYPE_HYPERSONIC
public static final java.lang.String TYPE_HYPERSONIC
- See Also:
- Constant Field Values
TYPE_INFORMIX
public static final java.lang.String TYPE_INFORMIX
- See Also:
- Constant Field Values
TYPE_INGRES
public static final java.lang.String TYPE_INGRES
- See Also:
- Constant Field Values
TYPE_INTERBASE
public static final java.lang.String TYPE_INTERBASE
- See Also:
- Constant Field Values
TYPE_JDATASTORE
public static final java.lang.String TYPE_JDATASTORE
- See Also:
- Constant Field Values
TYPE_MYSQL
public static final java.lang.String TYPE_MYSQL
- See Also:
- Constant Field Values
TYPE_ORACLE
public static final java.lang.String TYPE_ORACLE
- See Also:
- Constant Field Values
TYPE_POSTGRESQL
public static final java.lang.String TYPE_POSTGRESQL
- See Also:
- Constant Field Values
TYPE_SAP
public static final java.lang.String TYPE_SAP
- See Also:
- Constant Field Values
TYPE_SQLSERVER
public static final java.lang.String TYPE_SQLSERVER
- See Also:
- Constant Field Values
TYPE_SYBASE
public static final java.lang.String TYPE_SYBASE
- See Also:
- Constant Field Values
TYPE_ALL
public static final java.lang.String[] TYPE_ALL
ALTER_COLUMN_TYPE
protected static java.lang.String ALTER_COLUMN_TYPE
ALTER_COLUMN_NAME
protected static java.lang.String ALTER_COLUMN_NAME
DROP_PRIMARY_KEY
protected static java.lang.String DROP_PRIMARY_KEY
REWORD_TEMPLATE
protected static java.lang.String[] REWORD_TEMPLATE
TEMPLATE
protected static java.lang.String[] TEMPLATE
DBUtil
protected DBUtil(java.lang.String type)
getInstance
public static DBUtil getInstance()
getInstance
public static DBUtil getInstance(java.lang.String type)
setInstance
public static void setInstance(org.hibernate.dialect.Dialect dialect)
buildCreateFile
public void buildCreateFile(java.lang.String databaseName)
throws java.io.IOException
- Throws:
java.io.IOException
buildSQL
public abstract java.lang.String buildSQL(java.lang.String template)
throws java.io.IOException
- Throws:
java.io.IOException
buildSQLFile
public void buildSQLFile(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
getTemplateFalse
public java.lang.String getTemplateFalse()
getTemplateTrue
public java.lang.String getTemplateTrue()
getType
public java.lang.String getType()
isSupportsAlterColumnName
public boolean isSupportsAlterColumnName()
isSupportsAlterColumnType
public boolean isSupportsAlterColumnType()
isSupportsStringCaseSensitiveQuery
public boolean isSupportsStringCaseSensitiveQuery()
isSupportsUpdateWithInnerJoin
public boolean isSupportsUpdateWithInnerJoin()
runSQL
public void runSQL(java.lang.String sql)
throws java.io.IOException,
java.sql.SQLException
- Throws:
java.io.IOException
java.sql.SQLException
runSQL
public void runSQL(java.sql.Connection con,
java.lang.String sql)
throws java.io.IOException,
java.sql.SQLException
- Throws:
java.io.IOException
java.sql.SQLException
runSQL
public void runSQL(java.lang.String[] sqls)
throws java.io.IOException,
java.sql.SQLException
- Throws:
java.io.IOException
java.sql.SQLException
runSQL
public void runSQL(java.sql.Connection con,
java.lang.String[] sqls)
throws java.io.IOException,
java.sql.SQLException
- Throws:
java.io.IOException
java.sql.SQLException
runSQLTemplate
public void runSQLTemplate(java.lang.String path)
throws java.io.IOException,
javax.naming.NamingException,
java.sql.SQLException
- Throws:
java.io.IOException
javax.naming.NamingException
java.sql.SQLException
runSQLTemplate
public void runSQLTemplate(java.lang.String path,
boolean failOnError)
throws java.io.IOException,
javax.naming.NamingException,
java.sql.SQLException
- Throws:
java.io.IOException
javax.naming.NamingException
java.sql.SQLException
runSQLTemplateString
public void runSQLTemplateString(java.lang.String template,
boolean evaluate,
boolean failOnError)
throws java.io.IOException,
javax.naming.NamingException,
java.sql.SQLException
- Throws:
java.io.IOException
javax.naming.NamingException
java.sql.SQLException
setSupportsStringCaseSensitiveQuery
public void setSupportsStringCaseSensitiveQuery(boolean supportsStringCaseSensitiveQuery)
buildCreateFile
protected abstract void buildCreateFile(java.lang.String databaseName,
boolean minimal)
throws java.io.IOException
- Throws:
java.io.IOException
buildColumnNameTokens
protected java.lang.String[] buildColumnNameTokens(java.lang.String line)
buildColumnTypeTokens
protected java.lang.String[] buildColumnTypeTokens(java.lang.String line)
buildTemplate
protected java.lang.String buildTemplate(java.lang.String fileName)
throws java.io.IOException
- Throws:
java.io.IOException
convertTimestamp
protected java.lang.String convertTimestamp(java.lang.String data)
evaluateVM
protected java.lang.String evaluateVM(java.lang.String template)
throws java.lang.Exception
- Throws:
java.lang.Exception
getMinimalSuffix
protected java.lang.String getMinimalSuffix(boolean minimal)
getServerName
protected abstract java.lang.String getServerName()
getTemplate
protected abstract java.lang.String[] getTemplate()
readSQL
protected java.lang.String readSQL(java.lang.String fileName,
java.lang.String comments,
java.lang.String eol)
throws java.io.IOException
- Throws:
java.io.IOException
removeBooleanIndexes
protected java.lang.String removeBooleanIndexes(java.lang.String data)
throws java.io.IOException
- Throws:
java.io.IOException
removeInserts
protected java.lang.String removeInserts(java.lang.String data)
throws java.io.IOException
- Throws:
java.io.IOException
removeLongInserts
protected java.lang.String removeLongInserts(java.lang.String data)
throws java.io.IOException
- Throws:
java.io.IOException
removeNull
protected java.lang.String removeNull(java.lang.String content)
replaceTemplate
protected java.lang.String replaceTemplate(java.lang.String template,
java.lang.String[] actual)
reword
protected abstract java.lang.String reword(java.lang.String data)
throws java.io.IOException
- Throws:
java.io.IOException