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