001
014
015 package com.liferay.portal.kernel.dao.db;
016
017 import com.liferay.portal.kernel.exception.SystemException;
018
019 import java.io.IOException;
020
021 import java.sql.Connection;
022 import java.sql.SQLException;
023
024 import java.util.List;
025
026 import javax.naming.NamingException;
027
028
031 public interface DB {
032
033 public static final int MINIMAL = 1;
034
035 public static final int POPULATED = 0;
036
037 public static final int SHARDED = 2;
038
039 public static final String TYPE_DB2 = "db2";
040
041 public static final String TYPE_DERBY = "derby";
042
043 public static final String TYPE_FIREBIRD = "firebird";
044
045 public static final String TYPE_HYPERSONIC = "hypersonic";
046
047 public static final String TYPE_INFORMIX = "informix";
048
049 public static final String TYPE_INGRES = "ingres";
050
051 public static final String TYPE_INTERBASE = "interbase";
052
053 public static final String TYPE_JDATASTORE = "jdatastore";
054
055 public static final String TYPE_MYSQL = "mysql";
056
057 public static final String TYPE_ORACLE = "oracle";
058
059 public static final String TYPE_POSTGRESQL = "postgresql";
060
061 public static final String TYPE_SAP = "sap";
062
063 public static final String TYPE_SQLSERVER = "sqlserver";
064
065 public static final String TYPE_SYBASE = "sybase";
066
067 public static final String[] TYPE_ALL = {
068 TYPE_DB2, TYPE_DERBY, TYPE_FIREBIRD, TYPE_HYPERSONIC, TYPE_INFORMIX,
069 TYPE_INGRES, TYPE_INTERBASE, TYPE_JDATASTORE, TYPE_MYSQL, TYPE_ORACLE,
070 TYPE_POSTGRESQL, TYPE_SAP, TYPE_SQLSERVER, TYPE_SYBASE
071 };
072
073 public void buildCreateFile(String sqlDir, String databaseName)
074 throws IOException;
075
076 public void buildCreateFile(
077 String sqlDir, String databaseName, int population)
078 throws IOException;
079
080 public String buildSQL(String template) throws IOException;
081
082 public void buildSQLFile(String sqlDir, String fileName)
083 throws IOException;
084
085 public List<Index> getIndexes() throws SQLException;
086
087 public String getTemplateFalse();
088
089 public String getTemplateTrue();
090
091 public String getType();
092
093 public long increment() throws SystemException;
094
095 public boolean isSupportsAlterColumnName();
096
097 public boolean isSupportsAlterColumnType();
098
099 public boolean isSupportsDateMilliseconds();
100
101 public boolean isSupportsScrollableResults();
102
103 public boolean isSupportsStringCaseSensitiveQuery();
104
105 public boolean isSupportsUpdateWithInnerJoin();
106
107 public void runSQL(String sql) throws IOException, SQLException;
108
109 public void runSQL(Connection con, String sql)
110 throws IOException, SQLException;
111
112 public void runSQL(String[] sqls) throws IOException, SQLException;
113
114 public void runSQL(Connection con, String[] sqls)
115 throws IOException, SQLException;
116
117 public void runSQLTemplate(String path)
118 throws IOException, NamingException, SQLException;
119
120 public void runSQLTemplate(String path, boolean failOnError)
121 throws IOException, NamingException, SQLException;
122
123 public void runSQLTemplateString(
124 String template, boolean evaluate, boolean failOnError)
125 throws IOException, NamingException, SQLException;
126
127 public void setSupportsStringCaseSensitiveQuery(
128 boolean supportsStringCaseSensitiveQuery);
129
130 public void updateIndexes(
131 String tablesSQL, String indexesSQL, String indexesProperties,
132 boolean dropStaleIndexes)
133 throws IOException, SQLException;
134
135 }