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 String[] TYPE_ALL = {
040 DB.TYPE_DB2, DB.TYPE_HYPERSONIC, DB.TYPE_MYSQL, DB.TYPE_ORACLE,
041 DB.TYPE_POSTGRESQL, DB.TYPE_SQLSERVER, DB.TYPE_SYBASE
042 };
043
044 public static final String TYPE_DB2 = "db2";
045
046 public static final String TYPE_HYPERSONIC = "hypersonic";
047
048 public static final String TYPE_MYSQL = "mysql";
049
050 public static final String TYPE_ORACLE = "oracle";
051
052 public static final String TYPE_POSTGRESQL = "postgresql";
053
054 public static final String TYPE_SQLSERVER = "sqlserver";
055
056 public static final String TYPE_SYBASE = "sybase";
057
058 public void addIndexes(
059 Connection con, String indexesSQL, Set<String> validIndexNames)
060 throws IOException;
061
062 public void buildCreateFile(String sqlDir, String databaseName)
063 throws IOException;
064
065 public void buildCreateFile(
066 String sqlDir, String databaseName, int population)
067 throws IOException;
068
069 public String buildSQL(String template) throws IOException;
070
071 public void buildSQLFile(String sqlDir, String fileName) throws IOException;
072
073 public List<Index> getIndexes(Connection con) throws SQLException;
074
075 public int getMajorVersion();
076
077 public int getMinorVersion();
078
079 public String getTemplateFalse();
080
081 public String getTemplateTrue();
082
083 public String getType();
084
085 public String getVersionString();
086
087 public long increment();
088
089 public long increment(String name);
090
091 public boolean isSupportsAlterColumnName();
092
093 public boolean isSupportsAlterColumnType();
094
095 public boolean isSupportsInlineDistinct();
096
097 public boolean isSupportsQueryingAfterException();
098
099 public boolean isSupportsScrollableResults();
100
101 public boolean isSupportsStringCaseSensitiveQuery();
102
103 public boolean isSupportsUpdateWithInnerJoin();
104
105 public void runSQL(Connection con, String sql)
106 throws IOException, SQLException;
107
108 public void runSQL(Connection con, String[] sqls)
109 throws IOException, SQLException;
110
111 public void runSQL(String sql) throws IOException, SQLException;
112
113 public void runSQL(String[] sqls) throws IOException, SQLException;
114
115 public void runSQLTemplate(String path)
116 throws IOException, NamingException, SQLException;
117
118 public void runSQLTemplate(String path, boolean failOnError)
119 throws IOException, NamingException, SQLException;
120
121 public void runSQLTemplateString(
122 Connection connection, String template, boolean evaluate,
123 boolean failOnError)
124 throws IOException, NamingException, SQLException;
125
126 public void runSQLTemplateString(
127 String template, boolean evaluate, boolean failOnError)
128 throws IOException, NamingException, SQLException;
129
130 public void setSupportsStringCaseSensitiveQuery(
131 boolean supportsStringCaseSensitiveQuery);
132
133 public void updateIndexes(
134 Connection con, String tablesSQL, String indexesSQL,
135 boolean dropStaleIndexes)
136 throws IOException, SQLException;
137
138 }