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