| 1 | |
package liquibase.database; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import java.io.Writer; |
| 5 | |
import java.util.Date; |
| 6 | |
import java.util.List; |
| 7 | |
|
| 8 | |
import liquibase.change.Change; |
| 9 | |
import liquibase.changelog.ChangeSet; |
| 10 | |
import liquibase.changelog.DatabaseChangeLog; |
| 11 | |
import liquibase.changelog.RanChangeSet; |
| 12 | |
import liquibase.database.structure.DatabaseObject; |
| 13 | |
import liquibase.exception.DatabaseException; |
| 14 | |
import liquibase.exception.DatabaseHistoryException; |
| 15 | |
import liquibase.exception.DateParseException; |
| 16 | |
import liquibase.exception.LiquibaseException; |
| 17 | |
import liquibase.exception.RollbackImpossibleException; |
| 18 | |
import liquibase.exception.StatementNotSupportedOnDatabaseException; |
| 19 | |
import liquibase.exception.UnsupportedChangeException; |
| 20 | |
import liquibase.servicelocator.PrioritizedService; |
| 21 | |
import liquibase.sql.visitor.SqlVisitor; |
| 22 | |
import liquibase.statement.DatabaseFunction; |
| 23 | |
import liquibase.statement.SqlStatement; |
| 24 | |
|
| 25 | |
public interface Database extends DatabaseObject, PrioritizedService { |
| 26 | |
|
| 27 | |
String databaseChangeLogTableName = "DatabaseChangeLog".toUpperCase(); |
| 28 | |
String databaseChangeLogLockTableName = "DatabaseChangeLogLock".toUpperCase(); |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | |
boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException; |
| 34 | |
|
| 35 | |
|
| 36 | |
|
| 37 | |
|
| 38 | |
String getDefaultDriver(String url); |
| 39 | |
|
| 40 | |
DatabaseConnection getConnection(); |
| 41 | |
|
| 42 | |
void setConnection(DatabaseConnection conn); |
| 43 | |
|
| 44 | |
boolean requiresUsername(); |
| 45 | |
|
| 46 | |
boolean requiresPassword(); |
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
public boolean getAutoCommitMode(); |
| 52 | |
|
| 53 | |
|
| 54 | |
|
| 55 | |
|
| 56 | |
|
| 57 | |
|
| 58 | |
boolean supportsDDLInTransaction(); |
| 59 | |
|
| 60 | |
String getDatabaseProductName(); |
| 61 | |
|
| 62 | |
String getDatabaseProductVersion() throws DatabaseException; |
| 63 | |
|
| 64 | |
int getDatabaseMajorVersion() throws DatabaseException; |
| 65 | |
|
| 66 | |
int getDatabaseMinorVersion() throws DatabaseException; |
| 67 | |
|
| 68 | |
|
| 69 | |
|
| 70 | |
|
| 71 | |
|
| 72 | |
String getTypeName(); |
| 73 | |
|
| 74 | |
String getDefaultCatalogName() throws DatabaseException; |
| 75 | |
|
| 76 | |
String getDefaultSchemaName(); |
| 77 | |
|
| 78 | |
String getLiquibaseSchemaName(); |
| 79 | |
|
| 80 | |
void setDefaultSchemaName(String schemaName) throws DatabaseException; |
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
|
| 85 | |
boolean supportsInitiallyDeferrableColumns(); |
| 86 | |
|
| 87 | |
public boolean supportsSequences(); |
| 88 | |
|
| 89 | |
public boolean supportsDropTableCascadeConstraints(); |
| 90 | |
|
| 91 | |
public boolean supportsAutoIncrement(); |
| 92 | |
|
| 93 | |
String getDateLiteral(String isoDate); |
| 94 | |
|
| 95 | |
|
| 96 | |
|
| 97 | |
|
| 98 | |
String getCurrentDateTimeFunction(); |
| 99 | |
|
| 100 | |
void setCurrentDateTimeFunction(String function); |
| 101 | |
|
| 102 | |
String getLineComment(); |
| 103 | |
|
| 104 | |
String getAutoIncrementClause(); |
| 105 | |
|
| 106 | |
String getDatabaseChangeLogTableName(); |
| 107 | |
|
| 108 | |
String getDatabaseChangeLogLockTableName(); |
| 109 | |
|
| 110 | |
|
| 111 | |
|
| 112 | |
|
| 113 | |
|
| 114 | |
|
| 115 | |
public void setDatabaseChangeLogTableName(String tableName); |
| 116 | |
|
| 117 | |
|
| 118 | |
|
| 119 | |
|
| 120 | |
|
| 121 | |
|
| 122 | |
public void setDatabaseChangeLogLockTableName(String tableName); |
| 123 | |
|
| 124 | |
|
| 125 | |
|
| 126 | |
|
| 127 | |
String getConcatSql(String... values); |
| 128 | |
|
| 129 | |
boolean hasDatabaseChangeLogTable() throws DatabaseException; |
| 130 | |
|
| 131 | |
public void setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo); |
| 132 | |
|
| 133 | |
boolean hasDatabaseChangeLogLockTable() throws DatabaseException; |
| 134 | |
|
| 135 | |
void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, |
| 136 | |
String[] contexts) throws DatabaseException; |
| 137 | |
|
| 138 | |
void checkDatabaseChangeLogLockTable() throws DatabaseException; |
| 139 | |
|
| 140 | |
void dropDatabaseObjects(String schema) throws DatabaseException; |
| 141 | |
|
| 142 | |
void tag(String tagString) throws DatabaseException; |
| 143 | |
|
| 144 | |
boolean doesTagExist(String tag) throws DatabaseException; |
| 145 | |
|
| 146 | |
boolean isSystemTable(String catalogName, String schemaName, String tableName); |
| 147 | |
|
| 148 | |
boolean isLiquibaseTable(String tableName); |
| 149 | |
|
| 150 | |
boolean shouldQuoteValue(String value); |
| 151 | |
|
| 152 | |
boolean supportsTablespaces(); |
| 153 | |
|
| 154 | |
String getViewDefinition(String schemaName, String name) throws DatabaseException; |
| 155 | |
|
| 156 | |
boolean isSystemView(String catalogName, String schemaName, String name); |
| 157 | |
|
| 158 | |
String getDateLiteral(java.sql.Date date); |
| 159 | |
|
| 160 | |
String getTimeLiteral(java.sql.Time time); |
| 161 | |
|
| 162 | |
String getDateTimeLiteral(java.sql.Timestamp timeStamp); |
| 163 | |
|
| 164 | |
String getDateLiteral(Date defaultDateValue); |
| 165 | |
|
| 166 | |
|
| 167 | |
|
| 168 | |
|
| 169 | |
|
| 170 | |
|
| 171 | |
String escapeTableName(String schemaName, String tableName); |
| 172 | |
|
| 173 | |
String escapeIndexName(String schemaName, String indexName); |
| 174 | |
|
| 175 | |
String escapeDatabaseObject(String objectName); |
| 176 | |
|
| 177 | |
|
| 178 | |
|
| 179 | |
|
| 180 | |
|
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
|
| 185 | |
|
| 186 | |
|
| 187 | |
|
| 188 | |
String escapeColumnName(String schemaName, String tableName, String columnName); |
| 189 | |
|
| 190 | |
|
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | |
|
| 195 | |
|
| 196 | |
|
| 197 | |
|
| 198 | |
String escapeColumnNameList(String columnNames); |
| 199 | |
|
| 200 | |
|
| 201 | |
|
| 202 | |
String convertRequestedSchemaToSchema(String requestedSchema) throws DatabaseException; |
| 203 | |
|
| 204 | |
String convertRequestedSchemaToCatalog(String requestedSchema) throws DatabaseException; |
| 205 | |
|
| 206 | |
boolean supportsSchemas(); |
| 207 | |
|
| 208 | |
String generatePrimaryKeyName(String tableName); |
| 209 | |
|
| 210 | |
String escapeSequenceName(String schemaName, String sequenceName); |
| 211 | |
|
| 212 | |
String escapeViewName(String schemaName, String viewName); |
| 213 | |
|
| 214 | |
ChangeSet.RunStatus getRunStatus(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException; |
| 215 | |
|
| 216 | |
RanChangeSet getRanChangeSet(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException; |
| 217 | |
|
| 218 | |
void markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType) throws DatabaseException; |
| 219 | |
|
| 220 | |
List<RanChangeSet> getRanChangeSetList() throws DatabaseException; |
| 221 | |
|
| 222 | |
Date getRanDate(ChangeSet changeSet) throws DatabaseException, DatabaseHistoryException; |
| 223 | |
|
| 224 | |
void removeRanStatus(ChangeSet changeSet) throws DatabaseException; |
| 225 | |
|
| 226 | |
void commit() throws DatabaseException; |
| 227 | |
|
| 228 | |
void rollback() throws DatabaseException; |
| 229 | |
|
| 230 | |
String escapeStringForDatabase(String string); |
| 231 | |
|
| 232 | |
void close() throws DatabaseException; |
| 233 | |
|
| 234 | |
boolean supportsRestrictForeignKeys(); |
| 235 | |
|
| 236 | |
String escapeConstraintName(String constraintName); |
| 237 | |
|
| 238 | |
boolean isAutoCommit() throws DatabaseException; |
| 239 | |
|
| 240 | |
void setAutoCommit(boolean b) throws DatabaseException; |
| 241 | |
|
| 242 | |
boolean isLocalDatabase() throws DatabaseException; |
| 243 | |
|
| 244 | |
void executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors) |
| 245 | |
throws LiquibaseException, UnsupportedChangeException; |
| 246 | |
|
| 247 | |
|
| 248 | |
|
| 249 | |
|
| 250 | |
|
| 251 | |
|
| 252 | |
|
| 253 | |
|
| 254 | |
|
| 255 | |
|
| 256 | |
|
| 257 | |
void execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors) throws LiquibaseException; |
| 258 | |
|
| 259 | |
void saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, |
| 260 | |
UnsupportedChangeException, StatementNotSupportedOnDatabaseException, LiquibaseException; |
| 261 | |
|
| 262 | |
void executeRollbackStatements(Change change, List<SqlVisitor> sqlVisitors) throws LiquibaseException, |
| 263 | |
UnsupportedChangeException, RollbackImpossibleException; |
| 264 | |
|
| 265 | |
void saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer) throws IOException, |
| 266 | |
UnsupportedChangeException, RollbackImpossibleException, StatementNotSupportedOnDatabaseException, |
| 267 | |
LiquibaseException; |
| 268 | |
|
| 269 | |
int getNextChangeSetSequenceValue() throws LiquibaseException; |
| 270 | |
|
| 271 | |
public Date parseDate(String dateAsString) throws DateParseException; |
| 272 | |
|
| 273 | |
|
| 274 | |
|
| 275 | |
|
| 276 | |
public List<DatabaseFunction> getDatabaseFunctions(); |
| 277 | |
|
| 278 | |
void reset(); |
| 279 | |
|
| 280 | |
boolean supportsForeignKeyDisable(); |
| 281 | |
|
| 282 | |
boolean disableForeignKeyChecks() throws DatabaseException; |
| 283 | |
|
| 284 | |
void enableForeignKeyChecks() throws DatabaseException; |
| 285 | |
|
| 286 | |
public boolean isReservedWord(String string); |
| 287 | |
} |