forked from liquibase/liquibase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DatabaseConnection.java
61 lines (42 loc) · 1.75 KB
/
DatabaseConnection.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package liquibase.database;
import java.sql.Driver;
import java.util.Properties;
import liquibase.exception.DatabaseException;
import liquibase.servicelocator.PrioritizedService;
/**
* A liquibase abstraction over the normal Connection that is available in
* java.sql. This interface allows wrappers and aspects over the basic
* connection.
*
*/
public interface DatabaseConnection extends PrioritizedService, AutoCloseable {
void open(String url, Driver driverObject, Properties driverProperties)
throws DatabaseException;
/**
* Default implementation for compatibility with a URL.
* Method is used when a Connection is opened based on an identified driverObject from url.
* Can be overridden in DatabaseConnection implementations with a higher priority to check against a given url.
*
* @param url the url connection string
* @return true if URL is supported
*/
default boolean supports(String url) {
return true;
}
@Override
void close() throws DatabaseException;
void commit() throws DatabaseException;
boolean getAutoCommit() throws DatabaseException;
String getCatalog() throws DatabaseException;
String nativeSQL(String sql) throws DatabaseException;
void rollback() throws DatabaseException;
void setAutoCommit(boolean autoCommit) throws DatabaseException;
String getDatabaseProductName() throws DatabaseException;
String getDatabaseProductVersion() throws DatabaseException;
int getDatabaseMajorVersion() throws DatabaseException;
int getDatabaseMinorVersion() throws DatabaseException;
String getURL();
String getConnectionUserName();
boolean isClosed() throws DatabaseException;
void attached(Database database);
}