1 | |
package liquibase.database.core; |
2 | |
|
3 | |
import java.util.HashSet; |
4 | |
import java.util.Set; |
5 | |
|
6 | |
import liquibase.database.AbstractDatabase; |
7 | |
import liquibase.database.DatabaseConnection; |
8 | |
import liquibase.exception.DatabaseException; |
9 | |
|
10 | |
public class MaxDBDatabase extends AbstractDatabase { |
11 | |
|
12 | |
public static final String PRODUCT_NAME = "SAP DB"; |
13 | 1 | protected Set<String> systemTablesAndViews = new HashSet<String>(); |
14 | |
|
15 | |
public MaxDBDatabase() { |
16 | 1 | super(); |
17 | 1 | systemTablesAndViews.add("---"); |
18 | |
|
19 | 1 | systemTablesAndViews.add("ACTIVECONFIGURATION"); |
20 | 1 | systemTablesAndViews.add("BACKUPTHREADS"); |
21 | 1 | systemTablesAndViews.add("CACHESTATISTICS"); |
22 | 1 | systemTablesAndViews.add("CATALOGCACHESTATISTICS"); |
23 | 1 | systemTablesAndViews.add("COMMANDCACHESTATISTICS"); |
24 | 1 | systemTablesAndViews.add("COMMANDCACHESTATISTICSRESET"); |
25 | 1 | systemTablesAndViews.add("COMMANDSTATISTICS"); |
26 | 1 | systemTablesAndViews.add("COMMANDSTATISTICSRESET"); |
27 | 1 | systemTablesAndViews.add("CONSISTENTVIEWS"); |
28 | 1 | systemTablesAndViews.add("DATACACHE"); |
29 | 1 | systemTablesAndViews.add("DATASTATISTICS"); |
30 | 1 | systemTablesAndViews.add("DATASTATISTICSRESET"); |
31 | 1 | systemTablesAndViews.add("DATAVOLUMES"); |
32 | 1 | systemTablesAndViews.add("DATASTATISTICSRESET"); |
33 | 1 | systemTablesAndViews.add("FILEDIRECTORIES"); |
34 | 1 | systemTablesAndViews.add("FILES"); |
35 | 1 | systemTablesAndViews.add("HOTSTANDBYCOMPONENT"); |
36 | 1 | systemTablesAndViews.add("HOTSTANDBYGROUP"); |
37 | 1 | systemTablesAndViews.add("INSTANCE"); |
38 | 1 | systemTablesAndViews.add("IOBUFFERCACHES"); |
39 | 1 | systemTablesAndViews.add("IOTHREADSTATISTICS"); |
40 | 1 | systemTablesAndViews.add("IOTHREADSTATISTICSRESET"); |
41 | 1 | systemTablesAndViews.add("INDEXSIZE"); |
42 | 1 | systemTablesAndViews.add("INDEXSTORAGEDETAILS"); |
43 | 1 | systemTablesAndViews.add("LOGINFORMATION"); |
44 | 1 | systemTablesAndViews.add("LOGQUEUESTATISTICS"); |
45 | 1 | systemTablesAndViews.add("LOGQUEUESTATISTICSRESET"); |
46 | 1 | systemTablesAndViews.add("LOGSTATISTICS"); |
47 | 1 | systemTablesAndViews.add("LOGSTATISTICSRESET"); |
48 | 1 | systemTablesAndViews.add("LOGVOLUMES"); |
49 | 1 | systemTablesAndViews.add("MACHINECONFIGURATION"); |
50 | 1 | systemTablesAndViews.add("MACHINEUTILIZATION"); |
51 | 1 | systemTablesAndViews.add("MEMORYALLOCATORSTATISTICS"); |
52 | 1 | systemTablesAndViews.add("OPTIMIZERINFORMATION"); |
53 | 1 | systemTablesAndViews.add("READERWRITERLOCKINFORMATION"); |
54 | 1 | systemTablesAndViews.add("READERWRITERLOCKSTATISTICS"); |
55 | 1 | systemTablesAndViews.add("READERWRITERLOCKSTATISTICSRESET"); |
56 | 1 | systemTablesAndViews.add("READERWRITERLOCKWAITINGTASKS"); |
57 | 1 | systemTablesAndViews.add("REGIONINFORMATION"); |
58 | 1 | systemTablesAndViews.add("REGIONSTATISTICS"); |
59 | 1 | systemTablesAndViews.add("REGIONSTATISTICSRESET"); |
60 | 1 | systemTablesAndViews.add("RESTARTINFORMATION"); |
61 | 1 | systemTablesAndViews.add("SCHEMASIZE"); |
62 | 1 | systemTablesAndViews.add("SERVERTASKS"); |
63 | 1 | systemTablesAndViews.add("SESSIONS"); |
64 | 1 | systemTablesAndViews.add("SNAPSHOTS"); |
65 | 1 | systemTablesAndViews.add("SPINLOCKPOOLSTATISTICS"); |
66 | 1 | systemTablesAndViews.add("SPINLOCKPOOLSTATISTICSRESET"); |
67 | 1 | systemTablesAndViews.add("SPINLOCKSTATISTICS"); |
68 | 1 | systemTablesAndViews.add("SPINLOCKSTATISTICSRESET"); |
69 | 1 | systemTablesAndViews.add("TABLESIZE"); |
70 | 1 | systemTablesAndViews.add("TABLESTORAGEDETAILS"); |
71 | 1 | systemTablesAndViews.add("TASKGROUPSTATISTICS"); |
72 | 1 | systemTablesAndViews.add("TASKGROUPSTATISTICSRESET"); |
73 | 1 | systemTablesAndViews.add("TASKLOADBALANCINGINFORMATION"); |
74 | 1 | systemTablesAndViews.add("TASKLOADBALANCINGTASKGROUPSTATES"); |
75 | 1 | systemTablesAndViews.add("TASKLOADBALANCINGTASKMOVES"); |
76 | 1 | systemTablesAndViews.add("TRANSACTIONHISTORY"); |
77 | 1 | systemTablesAndViews.add("TRANSACTIONS"); |
78 | 1 | systemTablesAndViews.add("UNLOADEDSTATEMENTS"); |
79 | 1 | systemTablesAndViews.add("VERSION"); |
80 | 1 | } |
81 | |
|
82 | |
@Override |
83 | |
public int getPriority() { |
84 | 0 | return PRIORITY_DEFAULT; |
85 | |
} |
86 | |
|
87 | |
@Override |
88 | |
public Set<String> getSystemTablesAndViews() { |
89 | 0 | return systemTablesAndViews; |
90 | |
} |
91 | |
|
92 | |
@Override |
93 | |
public String getTypeName() { |
94 | 54 | return "maxdb"; |
95 | |
} |
96 | |
|
97 | |
@Override |
98 | |
public boolean supportsInitiallyDeferrableColumns() { |
99 | 0 | return false; |
100 | |
} |
101 | |
|
102 | |
@Override |
103 | |
public boolean supportsSequences() { |
104 | 14 | return true; |
105 | |
} |
106 | |
|
107 | |
@Override |
108 | |
public boolean isCorrectDatabaseImplementation(DatabaseConnection conn) throws DatabaseException { |
109 | 0 | return PRODUCT_NAME.equalsIgnoreCase(conn.getDatabaseProductName()); |
110 | |
} |
111 | |
|
112 | |
@Override |
113 | |
public String getDefaultDriver(String url) { |
114 | 0 | if (url.startsWith("jdbc:sapdb")) { |
115 | 0 | return "com.sap.dbtech.jdbc.DriverSapDB"; |
116 | |
} |
117 | 0 | return null; |
118 | |
} |
119 | |
|
120 | |
@Override |
121 | |
public String getCurrentDateTimeFunction() { |
122 | 0 | if (currentDateTimeFunction != null) { |
123 | 0 | return currentDateTimeFunction; |
124 | |
} |
125 | |
|
126 | 0 | return "TIMESTAMP"; |
127 | |
} |
128 | |
|
129 | |
@Override |
130 | |
protected String getDefaultDatabaseSchemaName() throws DatabaseException { |
131 | 0 | return super.getDefaultDatabaseSchemaName().toUpperCase(); |
132 | |
} |
133 | |
|
134 | |
@Override |
135 | |
public boolean isSystemTable(String catalogName, String schemaName, String tableName) { |
136 | 0 | if (super.isSystemTable(catalogName, schemaName, tableName)) { |
137 | 0 | return true; |
138 | 0 | } else if ("DOMAIN".equalsIgnoreCase(schemaName)) { |
139 | 0 | return true; |
140 | 0 | } else if ("SYSINFO".equalsIgnoreCase(schemaName)) { |
141 | 0 | return true; |
142 | 0 | } else if ("SYSLOADER".equalsIgnoreCase(schemaName)) { |
143 | 0 | return true; |
144 | 0 | } else if ("SYSDBA".equalsIgnoreCase(schemaName)) { |
145 | 0 | return true; |
146 | |
} |
147 | 0 | return false; |
148 | |
} |
149 | |
|
150 | |
@Override |
151 | |
public boolean isSystemView(String catalogName, String schemaName, String tableName) { |
152 | 0 | if (super.isSystemView(catalogName, schemaName, tableName)) { |
153 | 0 | return true; |
154 | 0 | } else if ("DOMAIN".equalsIgnoreCase(schemaName)) { |
155 | 0 | return true; |
156 | 0 | } else if ("SYSINFO".equalsIgnoreCase(schemaName)) { |
157 | 0 | return true; |
158 | 0 | } else if ("SYSLOADER".equalsIgnoreCase(schemaName)) { |
159 | 0 | return true; |
160 | 0 | } else if ("SYSDBA".equalsIgnoreCase(schemaName)) { |
161 | 0 | return true; |
162 | |
} |
163 | 0 | return false; |
164 | |
} |
165 | |
|
166 | |
@Override |
167 | |
public boolean supportsTablespaces() { |
168 | 0 | return false; |
169 | |
} |
170 | |
|
171 | |
@Override |
172 | |
public boolean supportsAutoIncrement() { |
173 | 6 | return false; |
174 | |
} |
175 | |
} |